fix: cached plugin events respect the specified client id #2806
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background: While experimenting with custom events, I found that some of the events that targeted a specific plugin instance were instead sent to all plugin instances. It turned out that events are cached until a plugin is loaded. But while all un-cached events are sent to the client that is specified in
PluginInstruction::Update
, this is not the case for cached events.I also found that this applies not only to my experimental events. Also, some standard events (e.g. TabUpdate) with specified client ids are among the cached events. So I suspect this fix might not only benefit future events, but also makes current cached events more specific.
Description of the changes:
WasmBridge::cached_events_for_pending_plugins
now includes theOption<ClientId>
specified inPluginInstruction::Update
. The functionapply_cached_events
will respect these client ids, if provided.I consider this a small fix, so no separate issue has been opened.
All normal tests run fine. Unfortunately I was not able to get the E2E tests running on my Mac, so I could only do some manual tests.