Page MenuHomePhabricator

[web] Add setInitialReduxState action
ClosedPublic

Authored by michal on Sep 12 2023, 3:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 7, 8:31 AM
Unknown Object (File)
Apr 7 2024, 12:18 AM
Unknown Object (File)
Apr 5 2024, 11:02 AM
Unknown Object (File)
Apr 5 2024, 11:02 AM
Unknown Object (File)
Apr 5 2024, 11:02 AM
Unknown Object (File)
Apr 5 2024, 10:53 AM
Unknown Object (File)
Mar 4 2024, 3:01 PM
Unknown Object (File)
Mar 2 2024, 11:58 AM
Subscribers

Details

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)

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

What happens if this action fails?

Improved error handling in D9141. It will bubble up any errors to the error boundary.

Different convention than useDispatchActionPromise, but the reason sounds convincing.

This revision is now accepted and ready to land.Sep 15 2023, 2:47 AM