Skip to content

Commit a0f7361

Browse files
committed
fix: hash changed to external in crank-todomvc
1 parent 67a8625 commit a0f7361

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

public/code/crank-async-generator.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const {createElement, renderer} = Crank;
88

99
appendCss(`
1010
#mountNode { padding: 20px }
11-
`)
11+
`);
1212

1313
// https://github.com/bikeshaving/crank/tree/master/examples/async-generator
1414
const mount = document.getElementById("mountNode");
@@ -21,7 +21,7 @@ async function* List(
2121
for await ({elems} of this) {
2222
i++;
2323
if (i % 5 === 0) {
24-
yield <div>Loading {elems.length} items...</div>;
24+
yield (<div>Loading {elems.length} items...</div>);
2525
await new Promise((resolve) => setTimeout(resolve, 4000));
2626
}
2727
yield (

public/code/crank-todomvc.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,12 @@ function save(todos) {
253253
}
254254

255255
function* App() {
256-
let todos = [];
256+
// let todos = [];
257+
let todos = [
258+
{ id: 1, title: 'sports', completed: true },
259+
{ id: 2, title: 'learn crank', completed: false },
260+
{ id: 3, title: 'get to work', completed: false },
261+
];
257262
let nextTodoId = 0;
258263
try {
259264
const storedTodos = JSON.parse(localStorage.getItem(STORAGE_KEY));
@@ -321,8 +326,10 @@ function* App() {
321326
break;
322327
}
323328
default: {
324-
filter = "";
325-
window.location.hash = `${prefix}/`;
329+
if (window.location.hash.startsWith(`${prefix}/`)) {
330+
filter = "";
331+
window.location.hash = `${prefix}/`;
332+
}
326333
}
327334
}
328335

0 commit comments

Comments
 (0)