Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Duplicate entries when lazyMode:true #272

Open
ucefkh opened this issue Apr 12, 2023 · 11 comments
Open

[BUG] Duplicate entries when lazyMode:true #272

ucefkh opened this issue Apr 12, 2023 · 11 comments

Comments

@ucefkh
Copy link

ucefkh commented Apr 12, 2023

This is a Serious bug I saw for a few years now that wasn't fixed yet

Reproduction:
Use react admin-firebase and set lazyMode:true that's it!

I can't share my Firebase app publicly so you can try it

Look how bad this is!

image

It is affecting us so much and I knew this bug for a few years now that was never fixed

@ucefkh
Copy link
Author

ucefkh commented Apr 12, 2023

image

@ucefkh
Copy link
Author

ucefkh commented Apr 12, 2023

seems people know about it and made this

https://www.npmjs.com/package/react-admin-firebase-lazy-load/v/3.2.32

@ucefkh
Copy link
Author

ucefkh commented Apr 14, 2023

Hello guys,

Any updates on this please?

@amilosmanli
Copy link
Contributor

@ucefkh I'm using the lazy loading as well, but never encountered this issue before.

Can you share your options that you pass to the FirebaseDataProvider ?

lazyMode:true is not the correct option btw, you should use

lazyLoading: {
    enabled: true,
  },

@quynguyencanalcircle
Copy link

Hi @ucefkh, I got the same problem.
I make a patch to fix on my side:

ResourceManager.ts:95

newDocs.forEach((d) =>{
      const data = parseFireStoreDocument<IResourceItem>(d);
      const existId = resource.list.findIndex(i => i.id === data.id);
      if(existId>=0) {
        resource.list[existId] = data
      } else {
        resource.list.push(data)
      }
    });

Hope this help!

@KonkretneKosteczki
Copy link

I get the same error even without lazy loading enabled. With the newest version of the react admin (4.9.3) and react admin firebase (4.1.2) Every time i refresh the page, entries get appended to the old ones.

@ucefkh
Copy link
Author

ucefkh commented Apr 21, 2023

yes @KonkretneKosteczki I confirm this is still a bug in 4.1.2 latest version!! so weird!

even though they got getServerCounter now!

@ucefkh
Copy link
Author

ucefkh commented Apr 22, 2023

Seems the issue comes from the getQueryCursor which doesnt find the last document id cursor so it fetches the docs again and again

but also we might need to enable indexing for fields??

https://firebase.google.com/docs/firestore/query-data/aggregation-queries

@ucefkh
Copy link
Author

ucefkh commented Apr 22, 2023

image

@ucefkh
Copy link
Author

ucefkh commented Apr 22, 2023

image

@ucefkh
Copy link
Author

ucefkh commented Apr 22, 2023

I fixed this issue on my fork

https://www.npmjs.com/package/react-admin-firebase-01tek

the solution was so dumb!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants