You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The states provided by the StateContextProvider have been migrated to Zustand stores in PR #224. As discussed in issue #211, the utilities in UrlContextProvider should also be migrated to Zustand to improve maintainability.
Objective
Migrate the utilities from UrlContextProvider to appropriate Zustand stores following the patterns established in PR #224.
Determine appropriate Zustand store for current states managed by UrlContextProvider
filePath: logFileStore? (We should remove the current reference in contextStore).
logEventIdx: viewStore?
isPrettified: viewStore?
Update components to use the new store(s) instead of the context
On app init (e.g., an useEffect hook in AppController with [] dependency array), call getWindowUrlSearchParams() and getWindowUrlHashParams(), and set corresponding states; also, window.addEventListener("hashchange", handleHashChange); where handleHashChange() calls getWindowUrlHashParams() and set corresponding states.
Remove the UrlContextProvider once migration is complete
Update existing utility functions in UrlContextProvider.tsx
updateWindowUrlHashParams should no longer call window.dispatchEvent(new HashChangeEvent("hashchange"))
Consider relocating the existing ones into src/utils/url.ts
If the above changes are already more than 400 lines (the YScope PR line limit), propose unit testing plan in the PR description; otherwise, if time allows, write unit tests for the URL utilities.
@zzxthehappiest I updated the "Tasks" section above for the items we discussed offline. Feel free to let me know if I missed anything or if you have any question.
Uh oh!
There was an error while loading. Please reload this page.
Background
The states provided by the
StateContextProvider
have been migrated to Zustand stores in PR #224. As discussed in issue #211, the utilities inUrlContextProvider
should also be migrated to Zustand to improve maintainability.Objective
Migrate the utilities from
UrlContextProvider
to appropriate Zustand stores following the patterns established in PR #224.Tasks
(drafted by @coderabbitai and updated by @junhaoliao on May 18)
UrlContextProvider
filePath
:logFileStore
? (We should remove the current reference in contextStore).logEventIdx
:viewStore
?isPrettified
:viewStore
?useEffect
hook inAppController
with[]
dependency array), callgetWindowUrlSearchParams()
andgetWindowUrlHashParams()
, and set corresponding states; also,window.addEventListener("hashchange", handleHashChange);
wherehandleHashChange()
callsgetWindowUrlHashParams()
and set corresponding states.UrlContextProvider
once migration is completeUrlContextProvider.tsx
updateWindowUrlHashParams
should no longer callwindow.dispatchEvent(new HashChangeEvent("hashchange"))
src/utils/url.ts
References
StateContextProvider
to Zustand stores)Assignee
@junhaoliao
The text was updated successfully, but these errors were encountered: