Skip to content

search: Move query state out of root component state via zustand

Warren Gifford requested to merge fkling/21200-stutter into main

Created by: fkling

This PR solves #21200 (closed) by moving the QueryState related data out of the root component state and into a separate store (via https://zustand.surge.sh/), which components that need this data subscribe to. It might be possible to push down using the store even more but I didn't want to make too many assumptions about how the component is used (since using that store basically means that there can only be single instance of that component in the component tree).

In the future I could imagine the module to export additional methods for query modification.

https://user-images.githubusercontent.com/179026/132872202-6972e2b1-538c-4e2b-96f5-69a0714be8aa.mp4

Here is a video that highlights component renders (first tab: current version, second tab: this PR's version):

https://user-images.githubusercontent.com/179026/133248817-1aba31e9-c6be-4530-96ad-3489a6c964cb.mp4


Would love for @sourcegraph/frontend-platform to chime in on whether they are OK with trying this approach (bringing in zustand).

Merge request reports

Loading