Closed thegecko closed 1 year ago
If I understand your issue correctly, you should be able to resolve it by specifying the sender
option when adding a message handler, which was introduced in v0.4.3: messenger.ts
Thanks, I'll take a look...
@thegecko
Please take a look here https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/pull/3/files
There is an example how the sender
can be used to "talk" to different webview panels
Awesome, thanks for the PR, This now works as expected.
The only issue I see is an error in the console when closing the panel that the webview is disposed, but functionally everything is working fine.
@thegecko Make sure your handler are properly disposed, when a view is disposed. If it doesn't help please open an issue
Make sure your handler are properly disposed, when a view is disposed. If it doesn't help please open an issue
I believe you included handler disposal in the panel on your PR, but the issue persisted. Do I need to dispose the handlers in the webview, too?
I believe you included handler disposal in the panel on your PR
Yes, I think so. Maybe I did something wrong there :) So probably one need to debug why an event was send to a closed view and by whom...
So probably one need to debug why an event was send to a closed view and by whom...
I investigated this issue, and opened https://github.com/TypeFox/vscode-messenger/issues/10
@thegecko Very nice, thanks!
We have an extension which can spawn multiple WebviewPanels with different data.
Switching to using
vscode-messenger
for the RPC between each WebViewPanel/View pair has uncovered an issue (or I haven't understood something!)Using
WebviewIdMessageParticipant
in the panel allows messages to target just the view associated with it.However, there is no way for the view to only target messages to its related panel. Using
HOST_EXTENSION
seems to broadcast messages to all created panels of that type.This is fine for scenarios with a single WebViewPanel, but in our tests, the messaging breaks as soon as multiple WebViewPanels of the same type are created.
A PR for our extension demonstrating this issue can be found here:
https://github.com/eclipse-cdt-cloud/vscode-memory-inspector/pull/2