File tree Expand file tree Collapse file tree 1 file changed +1
-14
lines changed
demos/react-supabase-todolist/src/components/providers Expand file tree Collapse file tree 1 file changed +1
-14
lines changed Original file line number Diff line number Diff line change @@ -44,12 +44,7 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
4444 compareBy : ( item ) => JSON . stringify ( item )
4545 } ) ,
4646 watch : {
47- // This provides instant caching of the query results.
48- // SQLite calls are asynchronous - therefore on page refresh the placeholder data will be used until the query is resolved.
49- // This uses localStorage to synchronously display a cached version while loading.
50- // Note that the TodoListsWidget is wraped by a GuardBySync component, which will prevent rendering until the query is resolved.
51- // Disable GuardBySync to see the placeholder data in action.
52- placeholderData : JSON . parse ( localStorage . getItem ( 'listscache' ) ?? '[]' ) as EnhancedListRecord [ ] ,
47+ placeholderData : [ ] ,
5348 query : new GetAllQuery < EnhancedListRecord > ( {
5449 sql : /* sql */ `
5550 SELECT
@@ -71,14 +66,6 @@ export const SystemProvider = ({ children }: { children: React.ReactNode }) => {
7166 }
7267 } ) ;
7368
74- // This updates a cache in order to display results instantly on page load.
75- listsQuery . registerListener ( {
76- onData : ( data ) => {
77- // Store the data in localStorage for instant caching
78- localStorage . setItem ( 'listscache' , JSON . stringify ( data ) ) ;
79- }
80- } ) ;
81-
8269 return {
8370 lists : listsQuery
8471 } ;
You can’t perform that action at this time.
0 commit comments