@@ -41,8 +41,8 @@ const initialStatesMap = new WeakMap<FirebaseApp, SSRStore>()
4141 * @returns the initial states for the current firebaseApp
4242 */
4343export function useSSRInitialState (
44- initialState ? : SSRStore ,
45- firebaseApp : FirebaseApp = useFirebaseApp ( )
44+ initialState : SSRStore | undefined ,
45+ firebaseApp : FirebaseApp
4646) : SSRStore {
4747 // get initial state based on the current firebase app
4848 if ( ! initialStatesMap . has ( firebaseApp ) ) {
@@ -60,15 +60,16 @@ export function getInitialValue(
6060 _FirestoreDataSource | DatabaseReference | DatabaseQuery | StorageReference
6161 > ,
6262 ssrKey : string | undefined ,
63- fallbackValue : unknown
63+ fallbackValue : unknown ,
64+ firebaseApp : FirebaseApp
6465) {
6566 if ( ! dataSource ) return fallbackValue
6667
6768 const [ sourceType , path ] = getDataSourceInfo ( dataSource )
6869 if ( ! sourceType ) return fallbackValue
6970
7071 const initialState : Record < string , unknown > =
71- useSSRInitialState ( ) [ sourceType ] || { }
72+ useSSRInitialState ( undefined , firebaseApp ) [ sourceType ] || { }
7273 const key = ssrKey || path
7374
7475 // TODO: warn for queries on the client if there are other keys and this is during hydration
@@ -82,14 +83,18 @@ export function deferInitialValueSetup(
8283 _FirestoreDataSource | DatabaseReference | DatabaseQuery | StorageReference
8384 > ,
8485 ssrKey : string | undefined | null ,
85- promise : Promise < unknown >
86+ promise : Promise < unknown > ,
87+ firebaseApp : FirebaseApp
8688) {
8789 if ( ! dataSource ) return
8890
8991 const [ sourceType , path ] = getDataSourceInfo ( dataSource )
9092 if ( ! sourceType ) return
9193
92- const initialState : Record < string , unknown > = useSSRInitialState ( ) [ sourceType ]
94+ const initialState : Record < string , unknown > = useSSRInitialState (
95+ undefined ,
96+ firebaseApp
97+ ) [ sourceType ]
9398 const key = ssrKey || path
9499
95100 if ( key ) {
0 commit comments