react-firebase-hooks icon indicating copy to clipboard operation
react-firebase-hooks copied to clipboard

Next.js with reactStrictMode the useDocumentOnce snapshot is never retrived

Open jasan-s opened this issue 3 years ago • 1 comments

with reactStrictMode=true in the next.config.js during development the useDocumentOnce never retrieves the snapshot data with useDocumentOnce , the loading remains true

If i set reactStrictMode=false useDocumentOnce retrieves the data correctly.

my currect hack is the following:

	const [snapshot, loading, error] =
	  process && process.env.NODE_ENV === 'development'
		? useDocument(doc(getFirestore(firebaseApp), 'collection', 'documentId'))
		: useDocumentOnce(doc(getFirestore(firebaseApp), 'collection', 'documentId'))

jasan-s avatar Sep 14 '22 01:09 jasan-s

Hello guys ! I also had the same issue !

Here are my project informations: "next": "12.2.3", "react-firebase-hooks": "^5.0.3", "firebase": "^9.9.4",

gBusato avatar Sep 15 '22 15:09 gBusato

Hi everybody, apologies for the delay in investigating this properly. I've just given this a try and it appears that some of the changes I've made in the newly released v5.1.0 may have inadvertently resolved this issue.

Could I ask you to try v5.1.0 and check whether this has been fixed?

chrisbianca avatar Nov 09 '22 16:11 chrisbianca

I am closing this issue as it has been confirmed working in #252, but if anybody else is still struggling, please let me know and I can look into it further!

chrisbianca avatar Nov 10 '22 16:11 chrisbianca