Skip to content

Commit 886fc50

Browse files
committed
updates
1 parent b9712a4 commit 886fc50

13 files changed

Lines changed: 25 additions & 36 deletions

File tree

logo.png

17.1 KB
Loading

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"homepage": "https://github.com/ryansolid/solid-realworld#readme",
2626
"dependencies": {
2727
"marked": "^0.8.0",
28-
"solid-js": "0.16.8"
28+
"solid-js": "0.16.9"
2929
},
3030
"devDependencies": {
3131
"@babel/core": "7.8.4",

rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const plugins = [
1616
}),
1717
resolve({ extensions: [".js", ".jsx"] }),
1818
commonjs(),
19-
terser()
19+
process.env.production && terser()
2020
];
2121

2222
export default {

src/App.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { lazy } from "solid-js";
1+
import { lazy, createSignal } from "solid-js";
22
import { useStore, useRouter } from "./store";
33
import NavBar from "./components/NavBar";
44
import Home from "./pages/Home";
@@ -10,16 +10,17 @@ const Settings = lazy(() => import("./pages/Settings")),
1010
Auth = lazy(() => import("./pages/Auth"));
1111

1212
export default () => {
13-
const [store, { setAppLoaded, pullUser }] = useStore(),
13+
const [store, { pullUser }] = useStore(),
14+
[appLoaded, setAppLoaded] = createSignal(false),
1415
{ match, getParams } = useRouter();
1516

16-
if (!store.token) setAppLoaded();
17-
else pullUser().finally(() => setAppLoaded());
17+
if (!store.token) setAppLoaded(true);
18+
else pullUser().finally(() => setAppLoaded(true));
1819

1920
return (
2021
<>
2122
<NavBar />
22-
<Show when={store.appLoaded}>
23+
<Show when={appLoaded()}>
2324
<Suspense fallback={<div class="container">Loading...</div>}>
2425
<Switch>
2526
<Match when={match("editor", /^editor\/?(.*)/)}><Editor {...getParams()} /></Match>

src/components/NavBar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default () => {
88
<nav class="navbar navbar-light">
99
<div class="container">
1010
<NavLink class="navbar-brand" route="">
11-
{store.appName.toLowerCase()}
11+
{store.appName}
1212
</NavLink>
1313
<ul class="nav navbar-nav pull-xs-right">
1414
<li class="nav-item">
@@ -35,12 +35,12 @@ export default () => {
3535
>
3636
<li class="nav-item">
3737
<NavLink class="nav-link" route="editor">
38-
<i class="ion-compose"></i> New Post
38+
<i class="ion-compose" /> New Post
3939
</NavLink>
4040
</li>
4141
<li class="nav-item">
4242
<NavLink class="nav-link" route="settings">
43-
<i class="ion-gear-a"></i> Settings
43+
<i class="ion-gear-a" /> Settings
4444
</NavLink>
4545
</li>
4646
<li class="nav-item">

src/pages/Home/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default function() {
1212
const query = new URLSearchParams(search);
1313
return query.get("tab");
1414
}),
15-
[, start] = useTransition({ timeoutMs: 300 }),
15+
[, start] = useTransition({ timeoutMs: 250 }),
1616
getPredicate = () => {
1717
switch (tab()) {
1818
case "feed":
@@ -32,5 +32,5 @@ export default function() {
3232

3333
createEffect(() => start(() => loadArticles(getPredicate())));
3434

35-
return Home({ handleSetPage, appName: appName.toLowerCase(), token, tab, store });
35+
return Home({ handleSetPage, appName, token, tab, store });
3636
}

src/pages/Settings.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ export default () => {
1515
submitForn = ev => {
1616
ev.preventDefault();
1717
const user = Object.assign({}, state);
18-
if (!user.password) {
19-
delete user.password;
20-
}
18+
if (!user.password) delete user.password;
19+
if (!user.image) delete user.image;
2120
setState({ updatingUser: true });
2221
updateUser(user)
2322
.then(() => (location.hash = `/@${user.username}`))

src/store/createAgent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default function createAgent([state, actions]) {
1616

1717
try {
1818
const response = await fetch(API_ROOT + url, opts);
19-
// if (response.status !== 200) throw response;
2019
const json = await response.json();
2120
return resKey ? json[resKey] : json;
2221
} catch (err) {

src/store/createArticles.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default function createArticles(agent, store, loadState, setState, loadAr
44
const [state, actions] = store;
55
store[1] = {
66
...actions,
7-
clear: () => setState({ articles: {}, page: 0 }),
87
setPage: page => setState({ page }),
98
loadArticles(predicate) {
109
const articles = $req(predicate).then(({ articles, articlesCount }) => {

0 commit comments

Comments
 (0)