Limit LocalStorage.setItem Attempts
See original GitHub issueHi, @ai!
We faced NS_ERROR_OUT_OF_MEMORY
error in Firefox. It might be the incognito mode or some plugin. Unfortunately, I don’t know how to reproduce the problem. It still works, but there is an issue. As I can see Logux retries to write the data all the time. I think we should limit attempts of writing to LocalStorage.
Stack trace:
function sendToTabs (client, event, data) {
if (!client.isLocalStorage) return
> localStorage.setItem(storageKey(client, event), JSON.stringify(data))
}
NS_ERROR_OUT_OF_MEMORY: No error message
at sendToTabs(./node_modules/@logux/client/cross-tab-client.js:11:16)
at leaderPing(./node_modules/@logux/client/cross-tab-client.js:22:3)
at apply(./node_modules/@logux/client/cross-tab-client.js:52:32)
at r(./node_modules/@sentry/browser/esm/helpers.js:71:23)
Firefox 72.0, Windows 10.
The error occurs every two seconds. Please let me know if I can help with the issue.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What is the max size of localStorage values? - Stack Overflow
upperLimit is 1GB by default, and just limits how far upwards to scan exponentially before starting the binary search. I doubt this will...
Read more >What is the max size of localStorage values? - GeeksforGeeks
localStorage limit in your Browser is 5000 KBs. Explanation: This javascript code will run by adding continuously increasing length strings ...
Read more >LocalStorage, sessionStorage - The Modern JavaScript Tutorial
Both key and value must be strings. The limit is 5mb+, depends on the browser. They do not expire. The data is bound...
Read more >Browser storage limits and eviction criteria - Web APIs | MDN
The maximum browser storage space is dynamic — it is based on your hard drive size. The global limit is calculated as 50%...
Read more >Using JavaScript to fill localStorage to its maximum capacity
How to programmatically fill localStorage and sessionStorage to their maximum capacity using JavaScript (mainly for testing purposes).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like they were able to write to localStorage initially (
isLocalStorage
is a result for initial check), but then memory was ended.Can I ask you to help me a little with a fix here? You need to fix a few small things:
try-catch
where you will setisLocalStorage = false
and change the role toleader
on the error.I think this PR will help you to be familiar with Logux internals.
Release in 0.6