Open Bug 1494428 Opened 6 years ago Updated 2 years ago

[remote-dbg-next] watchRuntime action is firing SUCCESS before finishing all async processing

Categories

(DevTools :: about:debugging, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: remote-debugging-technical-debt)

Follow up to Bug 1493968.

We have the following action: 

function watchRuntime(id) {
  return async (dispatch, getState) => {
    dispatch({ type: WATCH_RUNTIME_START });

    try {
      if (id === RUNTIMES.THIS_FIREFOX) {
        // THIS_FIREFOX connects and disconnects on the fly when opening the page.
        await dispatch(connectRuntime(RUNTIMES.THIS_FIREFOX));
      }

      // The selected runtime should already have a connected client assigned.
      const runtime = findRuntimeById(id, getState().runtimes);
      await dispatch({ type: WATCH_RUNTIME_SUCCESS, runtime });

      dispatch(Actions.requestExtensions());
      dispatch(Actions.requestTabs());
      dispatch(Actions.requestWorkers());
    } catch (e) {
      dispatch({ type: WATCH_RUNTIME_FAILURE, error: e.message });
    }
  };
}

(https://searchfox.org/mozilla-central/rev/ce57be88b8aa2ad03ace1b9684cd6c361be5109f/devtools/client/aboutdebugging-new/src/actions/runtimes.js#114)

The final dispatch is made with 

  await dispatch({ type: WATCH_RUNTIME_SUCCESS, runtime });

but after that we dispatch other asynchronous actions that will retrieve the various targets. I think the overall idea is fine as we want to start displaying the runtime page as soon as we can monitor the client, and maybe don't wan't to wait for targets to arrive.

However maybe we should have another dispatch at the end when all targets have been retrieved. Or we should have a loading indicator in the target panels to show that we are currently trying to fetch data.
Priority: -- → P2
Moving to Reserve Backlog for now.
Priority: P2 → P3
Note that this cleanup would allow for a safer way to wait for about:debugging to be ready. See https://phabricator.services.mozilla.com/D10575#256508
filter on remote-debugging-next-move-m3-to-m2
filter on remote-debugging-next-move-m3-to-m2
filter on remote-debugging-next-move-m3-to-m2
No longer blocks: remote-debugging-ng-m3
Whiteboard: old-remote-debugging-ng-m3

filter on: remote-debugging-m2-reserve-cleanup

Whiteboard: old-remote-debugging-ng-m3 → remote-debugging-technical-debt
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.