File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
src/fragments/lib/datastore/js Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -35,8 +35,9 @@ function App() {
3535 /**
3636 * Each keypress updates the post in local react state.
3737 */
38+ if (! post ) return ;
3839 setPost (
39- Post .copyOf < Post > (post , (draft ) => {
40+ Post .copyOf (post , (draft ) => {
4041 draft .title = value ;
4142 })
4243 );
@@ -49,6 +50,7 @@ function App() {
4950 /**
5051 * This post is already up to date because observeQuery updated it.
5152 */
53+ if (!post ) return;
5254 await DataStore .save <Post >(post );
5355 console .log (" Post saved" );
5456 }}
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ function onDeleteAll() {
109109}
110110
111111async function onQuery() {
112- const posts: Post [] = await DataStore .query <Post >(Post , (c : Post ) => c .rating .gt (4 ));
112+ const posts: Post [] = await DataStore .query <Post >(Post , (c ) => c .rating .gt (4 ));
113113
114114 console .log (posts );
115115}
You can’t perform that action at this time.
0 commit comments