Replies: 2 comments
-
Having same delete issue in 2024, @stefoid did you found out the solution? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm running into the same issue. For the time being, I have switched to Flatlist. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, Im using Realm database to provide flatlists with a results object (which appears like an array) that auto-magically updates itself when the underlying data in the database changes. In other words 'DATA' may spontaneously change.
One reason this is nice is because realm results are lazy loaded, so rather than pull into memory 5000 items and hand these to the flatlist in an array, it is convenient to provide the results object itself as DATA, and only those items that need to be rendered are ever instantiated
https://www.mongodb.com/docs/realm-sdks/js/latest/Realm.Results.html
I have a change listener attached to the results object, so I can get the flatlist to re-render when the results change, by changing a prop
HOWEVER, when I try to use FlashList as a drop-in replacement, I have problems that I hope you can help me with.
It works fine and much faster when the list is first instantiated, and scrolling up and down is great.
But when an item is added, the list does not update. Worse, when an item is deleted, the app crashes when flashlist tries to access an item that is now undefined.
I guess this is because flashlist is pure and because the results object itself is not changing, flashlist is trying to access stale data.
QUESTION How can I make this work -> take advantage of the realm result object lazy-loading without having to iterate through the entire result set and turn it into an plain old array before using it as DATA?
Beta Was this translation helpful? Give feedback.
All reactions