Page MenuHomePhabricator

[web] Add setInitialReduxState action
ClosedPublic

Authored by michal on Sep 12 2023, 3:14 AM.
Tags
None
Referenced Files
F3349049: D9140.id31299.diff
Fri, Nov 22, 4:54 PM
F3347456: D9140.diff
Fri, Nov 22, 12:23 PM
Unknown Object (File)
Thu, Nov 14, 7:37 AM
Unknown Object (File)
Sun, Nov 10, 11:47 AM
Unknown Object (File)
Fri, Nov 8, 12:28 AM
Unknown Object (File)
Fri, Nov 8, 12:28 AM
Unknown Object (File)
Fri, Nov 8, 12:08 AM
Unknown Object (File)
Thu, Nov 7, 8:05 PM
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
No Lint Coverage
Unit
No Test Coverage

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