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

Persist chat on window refresh #28

Closed
iamvishal345 opened this issue Oct 10, 2021 · 15 comments · May be fixed by #37
Closed

Persist chat on window refresh #28

iamvishal345 opened this issue Oct 10, 2021 · 15 comments · May be fixed by #37
Assignees
Labels
enhancement New feature or request

Comments

@iamvishal345
Copy link
Collaborator

@manuelalferez
I would like to work on adding feature to store chat into browser's storage so that if user refreshes the page the chat will persist.
I am thinking to leverage indexed DB API for that. Also clear that chat when user closes the chat box or navigate to other page.

@iamvishal345 iamvishal345 self-assigned this Oct 10, 2021
@iamvishal345 iamvishal345 added the enhancement New feature or request label Oct 10, 2021
@manuelalferez
Copy link
Owner

manuelalferez commented Oct 11, 2021

Man, you can't have bad ideas 😄 . Sound great

@iamvishal345
Copy link
Collaborator Author

@manuelalferez In our current webpack config we need to add babel packages for using async await. So I think instead of changing current config we should migrate to use vite by merging #26 PR. We just need to figure out why the build is failing. Other changes I have tested locally and everything is working fine

@manuelalferez
Copy link
Owner

manuelalferez commented Oct 11, 2021

@iamvishal345 if #26 works in your machine I will merge and I will configure vercel to use Vite. In my machine it's not working.

@iamvishal345
Copy link
Collaborator Author

@manuelalferez It is working but first we need to know why the build is failing.

@manuelalferez
Copy link
Owner

It was falling cause I was using the CRA config, now with Vite config, everything works.

@manuelalferez
Copy link
Owner

manuelalferez commented Oct 11, 2021

Now I am trying to solve this conflicts:
Captura de pantalla 2021-10-11 a las 18 18 34

@manuelalferez
Copy link
Owner

Solved.
#26 is now merged.

@iamvishal345
Copy link
Collaborator Author

iamvishal345 commented Oct 11, 2021

Solved. #26 is now merged.

Some recent changes are lost due to this merge.
I will raise a PR to add those changes again.

@iamvishal345
Copy link
Collaborator Author

@manuelalferez
I have merged the changes to master.
All the existing changes are working now.

@manuelalferez
Copy link
Owner

Thanks @iamvishal345

@iamvishal345
Copy link
Collaborator Author

@manuelalferez
I am facing one issue in this task.
When a user join admin post the message like "Welcome to the room" So if user keeps refreshing this message added again and again to the storage.
So What I am trying to do is to retrieve the last saved message from indexedDb but I am not able to find any solution for this So
please help me in how to retrieve the last saved message or any alternative approach.

@manuelalferez
Copy link
Owner

Hi @iamvishal345, could you create a pull request with what you have until now?

@manuelalferez
Copy link
Owner

manuelalferez commented Oct 19, 2021

The little that I have found, and perhaps this solution you have already tested is:

  1. Using IDBIndex.count() and IDBIndex.get()
let count = myIndex.count();
let lastRecord = IDBIndex.get(count)
  1. Using IDBIndex.getAll()
var getAllKeysRequest = IDBIndex.getAll(query, count);

Let me know if I didn't understand the problem well.

@iamvishal345 iamvishal345 linked a pull request Oct 19, 2021 that will close this issue
@iamvishal345
Copy link
Collaborator Author

Let me try this approach

@gitwikc
Copy link
Contributor

gitwikc commented Oct 29, 2021

This issue is addressed in PR #43 so this issue can be closed when it's merged

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

Successfully merging a pull request may close this issue.

3 participants