@@ -56,15 +56,20 @@ export async function connectToFirebase(model) {
5656 // also save filters to local storage
5757 //
5858 const options = JSON . parse ( localStorage . getItem ( "filterOptions" ) ) ;
59+ const search = localStorage . getItem ( "search" ) ;
5960 if ( options ) {
6061 model . setFilterOptions ( options ) ;
6162 }
63+ if ( search ) {
64+ model . setCurrentSearchText ( search ) ;
65+ }
6266
63- // automaticaly save filter options to local storage whenever they change
67+ // automaticaly save filter and search to local storage whenever they change
6468 reaction (
65- ( ) => ( { filterOptions : JSON . stringify ( model . filterOptions ) } ) ,
66- ( { filterOptions } ) => {
69+ ( ) => ( { filterOptions : JSON . stringify ( model . filterOptions ) , search : model . currentSearchText } ) ,
70+ ( { filterOptions, search } ) => {
6771 localStorage . setItem ( "filterOptions" , filterOptions ) ;
72+ localStorage . setItem ( "search" , search ) ;
6873 }
6974 ) ;
7075 /**
@@ -78,8 +83,10 @@ export async function connectToFirebase(model) {
7883 syncScrollPositionToFirebase ( model ) ;
7984 } else {
8085 model . setUser ( null ) ; // If no user, clear user-specific data
86+ model . setReady ( ) ;
8187 }
8288 } ) ;
89+
8390}
8491
8592// fetches all relevant information to create the model
@@ -100,6 +107,7 @@ async function firebaseToModel(model) {
100107 return currentData ; // Return the current data to avoid overwriting
101108 } ) ;
102109 } ) ;
110+ model . setReady ( ) ;
103111}
104112
105113/**
0 commit comments