-
Notifications
You must be signed in to change notification settings - Fork 559
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
Component does not always re-render when array changes (useObject) #5185
Comments
A quick look at your app, and I wonder if you need to add a subscription to |
@mvrahas Very strange that it happens every other time. I will investigate that part further. I would actually expect it to not re-render at all, and here is why. |
* Prime any list properties with an cachedCollection so that updates fire correctly (Fixes #5185) * Primary Keys as non-primative values would reset the cached objects, since their reference always changes * Create a listener on the collection if the object doesn't exist, and rerender when it is created (Fixes #4514)
* Prime any list properties with an cachedCollection so that updates fire correctly (Fixes #5185) * Primary Keys as non-primative values would reset the cached objects, since their reference always changes * Create a listener on the collection if the object doesn't exist, and rerender when it is created (Fixes #4514)
Thank you @takameyer It makes sense to me that that would be the expected behavior. If you wouldn't mind linking any helpful documentation to create an custom event listener, that would help me out |
@mvrahas I have opened a PR #5208. There was actually a few issues with Thanks again for creating this issue and reproduction! |
Awesome! Thank you |
* Refactor useObject * Prime any list properties with an cachedCollection so that updates fire correctly (Fixes #5185) * Primary Keys as non-primative values would reset the cached objects, since their reference always changes * Create a listener on the collection if the object doesn't exist, and rerender when it is created (Fixes #4514) * Ensure listeners are added to one instance of a collection. Co-authored-by: LJ <81748770+elle-j@users.noreply.github.com> Co-authored-by: Kræn Hansen <kraen.hansen@mongodb.com>
How frequently does the bug occur?
Seen always
Description
My task app schema includes an array of subtasks. When I push a new subtask to the array, the component doesn't re-render every time. It only re-renders every other time.
The interesting thing is that if I add in this Text below the Button, the component does re-render every time.
```{task ? task.subtasks.map((subtask,i)=>{subtask.description}) : null`}``
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
I created a sample app to demonstrate where this bug is happening for me..
Expected result: 'RE-RENDER' is printed to the console
Actual result: 'RE-RENDER' is not printed to the console
https://github.com/mvrahas/task-app-test
Version
0.4.1
What SDK flavour are you using?
Atlas Device Sync
Are you using encryption?
Yes, using encryption
Platform OS and version(s)
iOS 16.1.2
Build environment
Expo 47.0.3
Cocoapods version
No response
The text was updated successfully, but these errors were encountered: