This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
Replies: 1 comment 1 reply
-
Mouse movement is potentially a lot of reevaluations, but hard to say without profiling directly. You may want to consider adjusting the selectors to avoid caching. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a drag and drop app I'm trying to implement with Recoil and everything has been going fine so far, except in one situation where I have an atom selector returning some derived state.
The dependency chain looks like this:
Pointer move event --> atom<Data> --> selector<DerivedData> --> { multiple subscriber components }
The atom itself gets set at quite a high rate - it basically tracks the mouse's coordinates plus some other metadata. The downstream selector computes some state which multiple components rely on to determine whether or not the cursor location is currently within their boundaries.
I'm wondering if this a bad use case for selectors because the current implementation feels very sluggish and suffers from dropped frames compared to the version that didn't use selector derived state. The react profiler seems to indicate that there are no excessive re-renders going on.
Is this simply not what selectors were designed for?
Beta Was this translation helpful? Give feedback.
All reactions