downshift icon indicating copy to clipboard operation
downshift copied to clipboard

fix(useMouchAndTouchTracker): add refs to effect deps

Open seedy opened this issue 1 year ago • 2 comments

What:

  • Closes https://github.com/downshift-js/downshift/issues/1600

Why: this ensures mouse and touch tracker effect is always up to date with its refs bindings.

How: added a dependency to a useEffect

Checklist:

  • [ ] Documentation N/A
  • [ ] Tests N/A
  • [ ] TypeScript Types N/A
  • [ ] Flow Types N/A
  • [ ] Ready to be merged

seedy avatar Jun 05 '24 14:06 seedy

Thank you for the PR, will take a look!

silviuaavram avatar Jun 05 '24 14:06 silviuaavram

@silviuaavram Any update on this one?

aliceHendicott avatar Jun 27 '24 05:06 aliceHendicott

Looked at it and I would try to avoid adding and removing event listeners on every render. I would propose this one instead.

https://github.com/downshift-js/downshift/pull/1612

@aliceHendicott @seedy could you confirm the fix, please? It should be available as 9.0.7-alpha.1, once we are good to go I will release 9.0.7 with the fix. Thank you!

silviuaavram avatar Jul 08 '24 07:07 silviuaavram

Actually just go for 9.0.7-alpha.2.

silviuaavram avatar Jul 09 '24 08:07 silviuaavram

Hey @silviuaavram, thanks for getting an alpha release out. I forked @aliceHendicott's example and upgraded to 9.0.7-alpha.2, but it didn't fix the issue. This is my new sandbox for your reference. 🙏

https://github.com/downshift-js/downshift/assets/72391865/c7b5e252-15d7-4e00-b037-cad7ea17d47c

SL-23 avatar Jul 10 '24 00:07 SL-23

Thanks for the sandbox! Will let you know once I get some updates on this one.

silviuaavram avatar Jul 10 '24 07:07 silviuaavram

Still looking into how to do it without adding and removing the handlers on each render. Will update on the progress.

silviuaavram avatar Jul 11 '24 08:07 silviuaavram

Hi @silviuaavram 👀 wonder if there's any updates for this?

SL-23 avatar Jul 22 '24 23:07 SL-23

9.0.7-alpha.3

@SL-23 let me know if it works now. @aliceHendicott

silviuaavram avatar Jul 25 '24 07:07 silviuaavram

Hey @silviuaavram it works now. Thank you so much!

SL-23 avatar Jul 26 '24 01:07 SL-23