Skip to content

Commit 1549bbe

Browse files
committed
update to 1.0
1 parent 7d61edc commit 1549bbe

10 files changed

Lines changed: 2058 additions & 34 deletions

File tree

package-lock.json

Lines changed: 2040 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@
2525
"homepage": "https://github.com/solidjs/solid-realworld#readme",
2626
"dependencies": {
2727
"marked": "^0.8.0",
28-
"solid-js": "0.24.0"
28+
"solid-js": "^1.0.0"
2929
},
3030
"devDependencies": {
3131
"@babel/core": "7.12.13",
3232
"@babel/plugin-proposal-optional-chaining": "7.12.13",
3333
"@babel/plugin-syntax-dynamic-import": "7.8.3",
34+
"@rollup/plugin-babel": "5.2.0",
3435
"@rollup/plugin-commonjs": "17.1.0",
3536
"@rollup/plugin-node-resolve": "11.1.1",
36-
"babel-preset-solid": "0.24.0",
37+
"babel-preset-solid": "^1.0.0",
3738
"rollup": "2.38.4",
38-
"@rollup/plugin-babel": "5.2.0",
3939
"rollup-plugin-delete": "^2.0.0",
4040
"rollup-plugin-terser": "^7.0.0",
4141
"serve": "^11.3.2"

src/pages/Article/Comments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createState } from "solid-js";
1+
import { createStore } from "solid-js/store";
22
import NavLink from "../../components/NavLink";
33
import ListErrors from "../../components/ListErrors";
44
import { useStore } from "../../store";
@@ -36,7 +36,7 @@ const Comment = ({ comment, currentUser, onDelete }) => {
3636
};
3737

3838
const CommentInput = ({ slug, createComment, loadComments, currentUser }) => {
39-
const [state, setState] = createState({ body: "" }),
39+
const [state, setState] = createSore({ body: "" }),
4040
handleBodyChange = ev => setState({ body: ev.target.value }),
4141
createCommentHandler = ev => {
4242
ev.preventDefault();

src/pages/Auth.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { createState } from "solid-js";
1+
import { createStore } from "solid-js/store";
22
import NavLink from "../components/NavLink";
33
import ListErrors from "../components/ListErrors";
44
import { useStore } from "../store";
55

66
export default () => {
7-
const [state, setState] = createState({ username: "", inProgress: false }),
7+
const [state, setState] = createStore({ username: "", inProgress: false }),
88
[, { register, login }] = useStore(),
99
isLogin = location.hash.includes("login"),
1010
text = isLogin ? "Sign in" : "Sign up",

src/pages/Editor/Editor.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import { createState, createComputed } from "solid-js";
1+
import { createComputed } from "solid-js"
2+
import { createStore } from "solid-js/store";
23
import { useStore } from "../../store";
34
import ListErrors from "../../components/ListErrors";
45

56
export default ({ slug }) => {
67
const [store, { createArticle, updateArticle }] = useStore(),
7-
[state, setState] = createState({ tagInput: "", tagList: [] }),
8+
[state, setState] = createStore({ tagInput: "", tagList: [] }),
89
updateState = field => ev => setState(field, ev.target.value),
910
handleAddTag = () => {
1011
if (state.tagInput) {

src/pages/Settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { useStore } from "../store";
22
import ListErrors from "../components/ListErrors";
3-
import { createState } from "solid-js";
3+
import { createStore } from "solid-js/store";
44

55
export default () => {
66
const [store, { logout, updateUser }] = useStore(),
7-
[state, setState] = createState({
7+
[state, setState] = createStore({
88
image: store.currentUser.image || "",
99
username: store.currentUser.username,
1010
bio: store.currentUser.bio || "",

src/store/createArticles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function createArticles(agent, actions, state, setState) {
1919
if (article) return prev();
2020
return agent.Articles.get(args[1]).then((article) => ({ ...prev(), [args[1]]: article }));
2121
},
22-
{}
22+
{ initialValue: {} }
2323
);
2424

2525
function $req(predicate) {

src/store/createComments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function createComments(agent, actions, state, setState) {
44
const [comments, { mutate, refetch }] = createResource(
55
() => state.articleSlug,
66
agent.Comments.forArticle,
7-
[]
7+
{ initialValue: [] }
88
);
99
Object.assign(actions, {
1010
loadComments(articleSlug, reload) {

src/store/createCommon.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default function createCommon(agent, actions, state, setState) {
44
const [tags] = createResource(
55
"tags",
66
() => agent.Tags.getAll().then((tags) => tags.map((t) => t.toLowerCase())),
7-
[]
7+
{ initialValue: [] }
88
);
99
createEffect(() => {
1010
state.token ? localStorage.setItem("jwt", state.token) : localStorage.removeItem("jwt");

src/store/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { createContext, useContext, createState } from "solid-js";
1+
import { createContext, useContext } from "solid-js";
2+
import { createStore } from "solid-js/store";
23
import createAgent from "./createAgent";
34
import createArticles from "./createArticles";
45
import createAuth from "./createAuth";
@@ -12,7 +13,7 @@ const RouterContext = createContext();
1213
export function Provider(props) {
1314
let articles, comments, tags, profile, currentUser;
1415
const router = createRouteHandler(""),
15-
[state, setState] = createState({
16+
[state, setState] = createStore({
1617
get articles() {
1718
return articles();
1819
},

0 commit comments

Comments
 (0)