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

Cache channel list and messages data on web (Next, React) and desktop applications (Electron) like Get Stream React Native and Flutter mobile app caching feature #2173

Open
Gantushig97 opened this issue Nov 15, 2023 · 3 comments
Labels
feature New capability

Comments

@Gantushig97
Copy link

Motivation
I am working on a caching feature with the Get-Stream React/Next and Electron project. The app is built with Next with typescript and bundled with Electron. The final product will be a desktop and web app. I want to cache the channel list data, and their messages data and save them to some sort of local storage. (In my opinion web local storage would be too small)

Even though I want to use one solution for both of the platforms I mentioned, I am guessing that it would be futile since the platforms are so different.

(Our team's developers tried to cache the channel's data to the web's local storage and failed. )

The company I am currently working on has already made a mobile app with Flutter and Get-Stream. The Get-Stream Flutter and React-Native SDK have a caching feature that stores channel list data and messages. But the React SDK doesn't. I am hoping that the Get-Stream team could help me by creating a caching feature like the mobile SDK's.

Proposed solution
I want the Get-Stream team to implement a feature that caches all the necessary data in a web or desktop app. I don't have a particular solution yet, but I think it's possible to do it with local storage.

Acceptance Criteria
The caching solution should work on both React and Electron (web and web-based desktop apps). The solution should be integrated with the SDK's. If it's not possible at the moment (or I am wrong), please suggest a different method or a way to implement the feature. Thanks in advance.

@Gantushig97 Gantushig97 added the feature New capability label Nov 15, 2023
@Gantushig97 Gantushig97 changed the title Cache channel list and messages data caching with web (Next, React) and desktop applications (electron) like Get Stream React Native and Flutter mobile app caching feature Cache channel list and messages data on web (Next, React) and desktop applications (electron) like Get Stream React Native and Flutter mobile app caching feature Nov 15, 2023
@Gantushig97 Gantushig97 changed the title Cache channel list and messages data on web (Next, React) and desktop applications (electron) like Get Stream React Native and Flutter mobile app caching feature Cache channel list and messages data on web (Next, React) and desktop applications (Electron) like Get Stream React Native and Flutter mobile app caching feature Nov 15, 2023
@MartinCupela
Copy link
Contributor

Hello @Gantushig97 , thank you for the suggestion. We will keep it in our backlog for now as we do not plan to introduce cache support for the React SDK in the near future.

@Gantushig97
Copy link
Author

In that case, I would like to develop a custom caching feature for my app. Do you have any recommendations or ideas on how to do that? I tried to do it with Redis but could not pass the cached data to the SDK.

@MartinCupela
Copy link
Contributor

Hello @Gantushig97 you can set channels and active channel state. This API is accessible from the the ChatContext:

const { channel, channels, setActiveChannel, setChannels } = useChatContext(); 

But again, the SDK is not ready to support changing all the state it maintains. So even though you keep the data in some local storage, you may not be able to set it always. This will be your experiment, because the SDK does not claim to support what you are aiming at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New capability
Projects
None yet
Development

No branches or pull requests

2 participants