If the sidebar is closed before it responds as "ready", it will report errors
Reproduce
- 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 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
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
- intent:
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.
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
AbortControllerto cancel any in-flight_toggleSidebarcalls andrehydrateSidebarmessaging
This issue will be closed in 7 days unless the stale label is removed, or a comment is added to the issue.
This issue was closed because it has been stale for 7 days with no activity.