Persist message history to local storage#346
Merged
Hunter275 merged 2 commits intomeshtastic:message-historyfrom Nov 24, 2024
Merged
Persist message history to local storage#346Hunter275 merged 2 commits intomeshtastic:message-historyfrom
Hunter275 merged 2 commits intomeshtastic:message-historyfrom
Conversation
Member
|
This is great! @Hunter275 I'd love to get your take on it. |
|
Any reason this PR ended up in a separate branch and not merged into master? |
Member
Multiple PRs are going into this feature, easier to merge as one into master |
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.
@andrewheadricke's work to persist messages to localStorage in #342 piqued my interest so I took a stab at fleshing it out. This feature is requested in issue #162.
I've created a
MessageStoreclass which handles the CRUD operations on messages in localStorage. Each message is stored in a separate localStorage item to facilitate paginated loading on scroll.What's in the box:
I have never used zustand and immer so I wasn't sure how to best link this in with the deviceState. I had an issue where the ChannelChat component was not updating with new messages and state changes. To get it functional I resorted to a semaphore on the deviceState which is clearly not the best but it works. Any suggestions on how to improve this would be most welcome!