Page MenuHomePhabricator

[web] Add setInitialReduxState action
ClosedPublic

Authored by michal on Sep 12 2023, 3:14 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 28, 2:05 PM
Unknown Object (File)
Wed, Oct 16, 5:07 PM
Unknown Object (File)
Sun, Oct 13, 7:54 AM
Unknown Object (File)
Sep 28 2024, 7:35 PM
Unknown Object (File)
Sep 28 2024, 7:35 PM
Unknown Object (File)
Sep 28 2024, 7:35 PM
Unknown Object (File)
Sep 28 2024, 7:25 PM
Unknown Object (File)
Aug 28 2024, 1:35 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