[web] Add setInitialReduxState action
Summary:
ENG-4752
Depends on D9124
Action for the previously introduced endpoint. It's defined inside web and doesn't have the STARTED, SUCCESS, FAILED actions because:
- This is a web-specific endpoint that returns (and expects) web-specific data (e.g. urlInfo, web nav info)
- To simulate the previous behaviour as much possible this action shouldn't interact much with other reducers and that's why it's inside of the web reducer
- We don't really have use case for tracking progress and failure currently. The app can't function at all until this endpoint is called successfuly
- Adding the STARTED etc. variants and useDispatchActionPromise would require moving it to lib and BaseAction. But it can't be moved to lib because it uses web-specific types
If ever decide to expand it to native, it shouldn't be much of a problem to rework it (the added code is quite small).
Test Plan:
Call:
const callGetInitialReduxState = useServerCall(getInitialReduxState); const urlInfo = infoFromURL(decodeURI(window.location.href)); const payload = await callGetInitialReduxState(urlInfo); dispatch({ type: setInitialReduxState, payload });
after the app loaded.
- Check if the action contained the expected payload.
- Check that diff after applying this action only contained lastUserInteractionCalendar, lastPruned, updatesCurrentAsOf etc. (the "static" data was the same)
Reviewers: kamil, inka, atul
Reviewed By: kamil
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D9140