This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Debounce callback with version 0.6.0 #1604
Labels
bug
Something isn't working
Comments
Here is maybe a bit more "real world" example. Where I created There are two |
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this issue
Feb 15, 2022
Summary: NOTE: This is a breaking change, but the previous approach had a bug. Previously, `useRecoilCallback()` would attempt to provide a `Snapshot` based on the state that was currently rendered. However, there were some bugs where this was not the case. For example, a callback called from an effect handler may or may not have had the latest rendered state based on the timing of the setter. The new approach `useRecoilCallback()` will always try to get a snapshot with the latest state. This should also be more intuitive for users. Addresses facebookexperimental#1604 Differential Revision: D34236485 fbshipit-source-id: 773574feda763a74734503090474fff5c30de73f
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this issue
Feb 15, 2022
…tal#1610) Summary: Pull Request resolved: facebookexperimental#1610 NOTE: This is a breaking change, but the previous approach had a bug. Previously, `useRecoilCallback()` would attempt to provide a `Snapshot` based on the state that was currently rendered. However, there were some bugs where this was not the case. For example, a callback called from an effect handler may or may not have had the latest rendered state based on the timing of the setter. The new approach `useRecoilCallback()` will always try to get a snapshot with the latest state. This should also be more intuitive for users. Addresses facebookexperimental#1604 Reviewed By: habond Differential Revision: D34236485 fbshipit-source-id: 8a41e15556900dfb41628b2d77ea23409166f50a
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this issue
Feb 15, 2022
…tal#1610) Summary: Pull Request resolved: facebookexperimental#1610 NOTE: This is a breaking change, but the previous approach had a bug. Previously, `useRecoilCallback()` would attempt to provide a `Snapshot` based on the state that was currently rendered. However, there were some bugs where this was not the case. For example, a callback called from an effect handler may or may not have had the latest rendered state based on the timing of the setter. The new approach `useRecoilCallback()` will always try to get a snapshot with the latest state. This should also be more intuitive for users. Addresses facebookexperimental#1604 Reviewed By: habond Differential Revision: D34236485 fbshipit-source-id: fc10621f4569bff753c1755b4c2e41601d6b8069
drarmstr
added a commit
to drarmstr/Recoil
that referenced
this issue
Feb 16, 2022
…tal#1610) Summary: Pull Request resolved: facebookexperimental#1610 NOTE: This is a breaking change, but the previous approach had a bug. Previously, `useRecoilCallback()` would attempt to provide a `Snapshot` based on the state that was currently rendered. However, there were some bugs where this was not the case. For example, a callback called from an effect handler may or may not have had the latest rendered state based on the timing of the setter. The new approach `useRecoilCallback()` will always try to get a snapshot with the latest state. This should also be more intuitive for users. Addresses facebookexperimental#1604 Reviewed By: habond Differential Revision: D34236485 fbshipit-source-id: b8c79540e1e86fe8228bd32b4f003b7254d17f88
facebook-github-bot
pushed a commit
that referenced
this issue
Feb 16, 2022
Summary: Pull Request resolved: #1610 NOTE: This is a breaking change, but the previous approach had a bug. Previously, `useRecoilCallback()` would attempt to provide a `Snapshot` based on the state that was currently rendered. However, there were some bugs where this was not the case. For example, a callback called from an effect handler may or may not have had the latest rendered state based on the timing of the setter. The new approach `useRecoilCallback()` will always try to get a snapshot with the latest state. This should also be more intuitive for users. Addresses #1604 Reviewed By: habond Differential Revision: D34236485 fbshipit-source-id: 0cb17cec40b50e8debeb57dc193b9f410d170fc5
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey folks! I am not sure if this is an issue or wanted behaviour. But out of curiosity. I created this codesandbox where we have one atom and two buttons. Atom has a default value set to
first
. When you press any button it will change the value of the atom and then inuseEffect
it callsuseRecoilCallback
where it gets the value from the atom and console log it.debounce
it sets the value tosecond
. Then inuseEffect
it correctly prints out thesecond
as a value.third
. Then inuseEffect
it prints out the previous value of the atom (eitherfirst
orsecond
). But not thethird
. As I would expect.It works with 0.5 version.
I think it could be related to this change #1501. Any chance someone could explain to me what exactly happened?
Thank you 🙏
The text was updated successfully, but these errors were encountered: