-
Notifications
You must be signed in to change notification settings - Fork 95
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
Doesn't expire cached items prop with arrow functions #86
Comments
This is my temp fix:
|
How it's related to caching problem? |
@kesha-antonov I don't know why caching worked that way, but if you want to pass some changing variable in press function (state, prop, or smth that is changed) you should use actionParams.
|
It's not straightforward and looks more like a bug than a feature. I passed new props and I expect it to be used in a react component. |
@kesha-antonov it's a key reactivity issue. they use the index as the key, so react doesnt know that the menu item needs to be recomputed. Rule of thumb, never use an index as your key when mapping components; or expose this to the developer so they can explicitly tell react when components needs to be recomputed Here is a fix that only recomputes menu items when you want them to (like any mapping of components) rather than every single tick with your temp fix: |
Describe the bug
Doesn't expire cached items prop with functions
To Reproduce
Pass function to
onPress
initems
Even though you can pass updated items - it's cache on the lib side
Expected behavior
It should call items with new function passed
Actual behavior
Caches function forever
Screenshots
hold-menu-bug.mp4
Package versions
The text was updated successfully, but these errors were encountered: