paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
17 stars 2 forks source link

Web view does not always properly register message handler on moving web view - `useEventAsync` doesn't properly unsubscribe in some conditions #1303

Open tjcouch-sil opened 1 week ago

tjcouch-sil commented 1 week ago

Describe the bug When you move a web view from one location to another by dragging it around, sometimes, it will reload. When it reloads, there is a chance it does not properly unregister and register the message handler (created in #1185), so it does not always successfully receive postMessageToWebView messages.

To Reproduce Steps to reproduce the behavior:

  1. Set the DEV_NOISY environment variable to true and run Platform.Bible
  2. Open a Hello World Project Web View
  3. Open a viewer web view for the project web view
  4. Move the project web view somewhere else in the dock layout. Now, sometimes, when you click buttons on the viewer web view, you will notice that it does not properly set the highlighted name. Then repeat 4 again and see it may work or not work again.

Expected behavior The messages are always properly passed as the handler is always properly set up.

tjcouch-sil commented 1 week ago

Possibly same problem as #597 - see if that is fixed as well