Controller updates#2183
Open
divyanshugarg36 wants to merge 3 commits into
Open
Conversation
Two-way history sync so the web controller's History tab reflects what the desktop is showing, and vice versa. Mutations on either side broadcast sync/add/remove/clear events; both sides dedupe by shabadId. A new controller-bus module lets non-controller mutation sites (save-to-history, HistoryPane delete, MiscFooter clear-all) emit history events without prop-drilling the active socket. Helpers no-op when no session is active and swallow socket errors so local mutations never fail because of a flaky link. Also makes web verse-clicks navigate banis and ceremonies by falling back to BaniDB verseId when crossPlatformId doesn't match (web clients don't have desktop's local row ids). Hardens easy-peasy selectors in Launchpad, BaniController, useSlides, MultiPaneContent, MultiPaneHeader, and ShabadText against proxy-revoked crashes during rapid controller-driven action cascades by subscribing to leaf fields and wrapping Launchpad reads in a safe-select fallback.
The web bani-controller sends font-size events labeled gurbani /
translation / teeka / transliteration, but the userSettings store keys
those three sliders as content1 / content2 / content3. Two bugs fell
out of that mismatch:
- inbound changeFontSize tried to resolve setTranslationFontSize and
friends, which don't exist as actions, so font-size events from web
silently no-op'd.
- outbound fontSizes payload read savedSettings['translation-font-size']
etc — schema keys that don't exist — so the web controller's
font-size readouts reset to NaN whenever any setting changed.
Add a label-to-content-slot map on the inbound path, and read from the
actual content{1,2,3}-font-size schema keys on the outbound payload.
A grab-bag of fixes for the web bani-controller flow uncovered while testing the cross-device sync added in 66d2d2. Navigation (use-socket-listeners, handle-request-control): - bani and ceremony handlers now parse lineCount off the wire and pipe it into the navigator's lineNumber state, so ShabadText can fall back to position-based seeking when the BaniDB-global verseId doesn't match desktop's Realm-local verseIds (ceremonies in particular live in a different ID space). - both handlers also drop isMiscSlide / isAnnouncement on navigation, otherwise a prior Waheguru / Mool Mantra / announcement stayed on the projection while the state change happened invisibly behind it. - updatePane gets verseId as a third arg so the target pane's activeVerse is set directly — fallback in case the savedCrossPlatformId effect in ShabadText misses on a same-bani re-trigger. - request-control was passing adminPin (numeric) where the handler expected isPinCorrect (boolean), so the controller-on body class was always truthy. Pass the boolean. - handle-request-control was sending ceremonyId / sundarGutkaBaniId as the highlight on connect, which web tries to match against a verseId list and finds nothing. Send activeVerseId for both, and add an explicit verseId field on the wire alongside the legacy highlight. - echo current miscState on response-control so a web client that joins mid-announcement can hydrate its announcement chip. ShabadText highlight fallback: - when neither crossPlatformId nor verseId matches a row in the filtered list, fall back to lineNumber (1-based position) since both clients render the same row order. Add lineNumber to the effect deps. sendToBaniController (change-verse.js): - resolve the highlight via a guarded fallback chain (crossPlatformId → activeShabad.find → newTraversedVerse). The previous code crashed when the closure-captured activeShabad was still empty during the initial setVerseList → updateTraversedVerse call. - always emit verseId alongside highlight on bani / ceremony events so the web client (no crossPlatformId column) has something to match against. useNewShabad: reset isAnnouncement when starting a new shabad, otherwise the announcement-styling flag bled into the next misc slide. quick-tools-utils: clamp changeFontSize to [1, 30] so spamming the controller's minus button can't push a slider to zero/negative and the plus button can't run away.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.