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
STCOR-952 break QueryStateUpdates out to their own class-based component. (#1604)
Changes from [App
reordering](https://folio-org.atlassian.net/browse/STCOR-936) -
specifically a functional refactor of `MainNav` unearthed a handful of
errors at the app level, causing behaviors with logic that updates query
parameters/location. This PR takes the previous code from the
class-based `MainNav` and places it in its own component:
`QueryStateUpdater` - naming aside, this removes the potentially
offending logic from `MainNav`, leaving it to the task of simply
rendering the navigation/menus of the UI.
The useEffect implementations of the functional `MainNav` were written
to mirror the `componentDidMount` and `componentDidUpdate` lifecycle
methods of the class-based version. When the `location` was added to the
`cDM` dependency array in [This
PR](#1600), this meant
that the logic would no longer execute stricly on mount/dismount - but
anytime that the `location` updated... this would cause page refreshes,
as the logic would find a black `prevQueryState` every time and always
update the location, causing a refresh.
`componentDidUpdate` carried around its `prevProps`, unlike functional
react, where a state might be needed to accomplish such a comparison -
but this doesn't seem like an ideal solution for the functional version,
so here we are.
This is better because separately concerned logic is separated... worse
because the separated logic still has all of its tentacles into the App
layer and seems like a great example of a component that does too much -
why wouldn't/couldn't updating queryState/location actually just live at
the application level somehow? A question for future FOLIO...
0 commit comments