Repository navigation
Conversation
… when using ssb-chess-mithril that follows this pattern: *Poncho Wonky has an internal list of ‘views’ that it has a cache of rendered DOM for. If a view hasn’t been visited in 5 minutes, it’s removed from the cache and the next time the route is visited again it’s re-rendered and attached to the DOM. * ssb-chess-mithril, at startup, initiates a pull stream where the ‘source’ is events that the user might want a notification about and the ‘sink’ is displaying a notification. There’s nothing that aborts this stream when the chess view is removed from the cache (even though the chess component’s ‘destroy’ function is called to unmount the chess view and clear up some of its internal state.) * So if you switch between the chess view and other poncho views you’ll get multiple notification streams (a new one each time the view is remounted freshly after it’s been removed from the cache.) * This means multiple notifications will be displayed This PR solves this problem by: * Exposing notifications as a separate stream from ssb-chess-mithril * Creating a depject 'gives' exposing this stream alongside the chess component 'render' dependency and loading it at Patchwork startup so that notifications are displayed even if the chess component isn't mounted. This only happens once so multiple notifications will no longer be displayed. Other changes: * I cleaned up the initialisation code for the chess page rendering so that we don't have to loop (with a back-off) until mutant has put the chess component on the DOM
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.
There's currently a bug with notifications in the poncho-wonky client causing multiple chess notifications to sometimes be displayed for one notifiable event (such as it being the player's move.) The root cause is:
*Poncho Wonky has an internal list of ‘views’ that it has a cache of rendered DOM for. If a view hasn’t been visited in 5 minutes, it’s removed from the cache and the next time the route is visited again it’s re-rendered and attached to the DOM.
This PR solves this problem by:
Other changes:
Request for Feedback
lib/plugins/notifier.jsthat communicates over IPC from the server process to the electron rendering process to tell it to display a notification if the scuttlebutt feed message newly arriving should result in a notification. I didn't make my changes in this plugin because internally ssb-chess-mithril decides whether to notify based on whether the user is currently looking at the chess app (which isn't possible on the server side because there's no DOM document.)Let me know if you'd prefer me to try and come up with an alternative approach 😅