Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug where speaker notes are not connected to regular window #2675

Merged

Conversation

michael-kerscher
Copy link
Collaborator

Fixes bug #2004.
Refactored the communication between the speaker notes window and the regular window by using a Broadcast channel - this is now self-recovering(!) even if speaker notes are closed and manually re-opened!

For better readability and maintainability refactored some string-based states into enum style code and refactored detection of the type of windows (print, speaker note, regular window)

Manually tested the new code and the speaker notes window does not disconnect from the regular window anymore.
This now works way more reliable, even if there are (still) some UI glitches that have been there before already.

- Uses a ping-pong based approach via Broadcast channels to detect opens speaker notes.
Also renames the applyState to applyInlinePopupStyle to
better caputure the intent of the functionalit.

Defunct state is not possible anymore due to the broadcast channel
detection mechanism which is self-recovering the correct state.
Even if the speaker notes are closed, they are redetected and
properly synced when you reopen the closed window manually.
Rename the (set|get)State to (set|get)SpeakerNotesState to better catch the intent.
@michael-kerscher michael-kerscher force-pushed the fix-speaker-notes-async-bug branch from 64db7c2 to 622432a Compare February 28, 2025 16:35
Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this locally and it seems to work quite well -- thank you!!

I'm not an expert on plain JS. I don't see anything obviously wrong here, and there's basically no risk to landing this, but if you'd like a more skilled review of the implementation feel free to add someone else before merging.

@michael-kerscher michael-kerscher merged commit f22395d into google:main Feb 28, 2025
35 checks passed
@djmitche
Copy link
Collaborator

lol, or auto-merge :)

@michael-kerscher michael-kerscher deleted the fix-speaker-notes-async-bug branch February 28, 2025 18:26
@michael-kerscher michael-kerscher removed the request for review from mgeisler February 28, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants