primer / prism

A tool for creating and maintaining cohesive, consistent, and accessible color palettes
https://primer.style/prism/
MIT License
667 stars 38 forks source link

Quota Exceeded #27

Open bryanberger opened 2 years ago

bryanberger commented 2 years ago

Describe the bug Seems like the global_state in localStorage grows overtime and hits a quota and errors out resulting in the inability to move or interact with the UI at all.

Uncaught DOMException: The quota has been exceeded. main.832ea5e9.chunk.js:1
    a global-state.tsx:450
    <anonymous> self-hosted:1115
    update interpreter.js:259
    m interpreter.js:104
    process scheduler.js:64
    schedule scheduler.js:43
    send interpreter.js:98
    t.prototype.defer/this.delayedEventsMap[e.id]< interpreter.js:739
    (Async: setTimeout handler)
    setTimeout interpreter.js:1258
    t interpreter.js:1257
    defer interpreter.js:735
    exec interpreter.js:783
    execute interpreter.js:198
    update interpreter.js:224
    m interpreter.js:104
    process scheduler.js:64
    schedule scheduler.js:43
    send interpreter.js:98
    onChange scale.tsx:441
    React 11
    bind_applyFunctionN self-hosted:1313
    Jt self-hosted:1276
    unstable_runWithPriority scheduler.production.min.js:18
    React 3
    bind_applyFunctionN self-hosted:1313
    Xt self-hosted:1276
    receiveMessage SelectChild.jsm:272
    receiveMessage SelectChild.jsm:475

To Reproduce Steps to reproduce the behavior:

  1. Use prism a lot, with a lot of scales

Environment

colebemis commented 2 years ago

Wow, I didn't know localStorage had a quota. Thank you for reporting this, @bryanberger ! If you have any idea on how to work around this, feel free to open a PR :)

bryanberger commented 2 years ago

@colebemis We tried reducing the history size to 25 instead of 50 and debounced the serialization to localStorage that occurs onDrag right now. I haven't seen the error since.

stevenpetryk commented 2 years ago

I'll open a PR at some point with the localstorage serialization changes.