Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related #31 (comment)
We noticed this issue in Radix since the dependencies in our lock files were changed. I'm pretty sure the underlying issue was exposed when the
style
dependency was added in this effect viareact-style-singleton
.Accurate dependencies makes sense, but I think it was previously masking larger issues in consuming packages. As you can see in the original code, the offset query happens twice, once in the initial state setter and then again inside the
useEffect
. This wasn't an issue before asstyle-singleton
wasn't updating the stored style sooffset
would always be calculated from the same initial state.Here i've switched to updating the
gap
only once (and also when the prop is changed)I'm not convinced this is the best approach but I've struggled to validate what the correct behaviour should be, or where an appropriate change should be made.
Feel free to point me in the right direction and i'll be happy to update accordingly or work with you to provide a better solution.
Many thanks in advance.