pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

If the sidebar is closed before it responds as "ready", it will report errors

Open fregante opened this issue 3 years ago • 2 comments

Reproduce

  1. Double-click browser action

Current behavior

Messaging continues until it times out, potentially surfacing confusing errors like No handler registered for PING_SIDEBAR in the receiving end to the user.

Expected behavior

All messaging should stop and any current action should be stopped with a "User cancelled action" message/error.

Related

  • https://github.com/pixiebrix/pixiebrix-extension/pull/4079
  • https://github.com/pixiebrix/pixiebrix-extension/issues/4021
  • https://github.com/pixiebrix/webext-messenger/issues/78
  • #4124

fregante avatar Aug 26 '22 05:08 fregante

@fregante I don't think there's any reason to support double-click scenario. And the user intent is likely that they want to open/toggle the extension. I think I would debounce the browser action with a leading: true. Thought?

cc @corinnemayans

twschiller avatar Aug 26 '22 13:08 twschiller

I don't think there's any reason to support double-click scenario

That's just the repro for debugging purposes, it's not the common scenario.

Common scenarios:

  • click again because the sidebar isn't responding (as seen last week)
    • intent: open
  • "close sidebar" brick while the sidebar is opening
    • intent: close
  • double-click the button by mistake
    • intent:
      • if it was closed: open
      • if it was open: close or reload

the user intent is likely that they want to open/toggle the extension

Indeed there's a cutoff in expected behavior between "I expect the sidebar to open" and "I want to close the sidebar". Quick clicks mean that the sidebar should open.

fregante avatar Aug 26 '22 13:08 fregante

Downgrading to low priority as these two PRs made it rather difficult to have such issues:

  • https://github.com/pixiebrix/pixiebrix-extension/pull/4192
  • #4099

The only scenario where this could still rarely happen:

  • bricks and the user toggling the sidebar at the same time

What's next

  • [ ] Use AbortController to cancel any in-flight _toggleSidebar calls and rehydrateSidebar messaging

fregante avatar Aug 31 '22 19:08 fregante

This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.

github-actions[bot] avatar Dec 19 '23 16:12 github-actions[bot]

This issue was closed because it has been stale for 7 days with no activity.

github-actions[bot] avatar Dec 28 '23 00:12 github-actions[bot]