fix: remove dependency on hashchange event #455
Labels
effort/hours
Estimated to take one or several hours
exp/intermediate
Prior experience is likely helpful
kind/architecture
Core architecture of project
P0
Critical: Tackled by core team ASAP
status/ready
Ready to be worked
While integrating [email protected] into ipfs-webui, I ran into an issue because ipfs-webui is using
createRouteBundle
fromredux-bundler
. In order to get the ExplorePage working properly, I had towindow.dispatchEvent(new Event('hashchange'))
whenredux-bundler
provides an updatedurl
from theselectRouteInfo
selector.We need to decouple the hash-change event, so projects consuming these components can provide the current explore path and force updates and re-renders as appropriate. We don't want to require this property on the
ExploreProvider
because it would force consumers to render that provider wherever their url change logic is.potential solutions
forceRefresh
function inExploreContextProps
url
prop toExplorePage
and ensureExploreContextProps
is updated when a new url is received.doExploreUserProvidedPath
updatesexploreState
:ipld-explorer-components/src/providers/explore.tsx
Lines 121 to 124 in 5c97183
Recommended approach
useExplore
and thendoExploreUserProvidedPath
with whichever path#/explore
pathswindow.location.path
expectations.The text was updated successfully, but these errors were encountered: