Title: bug(undo-redo): QuotaExceededError when localStorage cap is exhausted by undo/redo snapshots · Issue #4737 · simstudioai/sim · GitHub
Open Graph Title: bug(undo-redo): QuotaExceededError when localStorage cap is exhausted by undo/redo snapshots · Issue #4737 · simstudioai/sim
X Title: bug(undo-redo): QuotaExceededError when localStorage cap is exhausted by undo/redo snapshots · Issue #4737 · simstudioai/sim
Description: Summary A QuotaExceededError: Failed to execute 'setItem' on 'Storage' can surface from various small Zustand-persisted stores (e.g., notification-storage, panel-editor-state) when a user has actively built workflows for some time. The s...
Open Graph Description: Summary A QuotaExceededError: Failed to execute 'setItem' on 'Storage' can surface from various small Zustand-persisted stores (e.g., notification-storage, panel-editor-state) when a user has activ...
X Description: Summary A QuotaExceededError: Failed to execute 'setItem' on 'Storage' can surface from various small Zustand-persisted stores (e.g., notification-storage, panel-editor-state) when ...
Opengraph URL: https://github.com/simstudioai/sim/issues/4737
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bug(undo-redo): QuotaExceededError when localStorage cap is exhausted by undo/redo snapshots","articleBody":"## Summary\n\nA `QuotaExceededError: Failed to execute 'setItem' on 'Storage'` can surface from various small Zustand-persisted stores (e.g., `notification-storage`, `panel-editor-state`) when a user has actively built workflows for some time. The stack trace points to the persist middleware's `setItem` call on whichever store happened to write next after the origin's localStorage cap was reached.\n\nThe store whose throw lands in monitoring is not the actual culprit — it's just the first victim after another store filled the origin's quota.\n\n## Root cause\n\n`workflow-undo-redo` is persisted to localStorage and stores operation snapshots that include full block state. Capacity is `MAX_STACKS=5 × DEFAULT_CAPACITY=100 = 500 ops`. Active editing of multiple workflows quickly fills the per-stack capacity with snapshots that can be several KB each, occupying the bulk of the origin's ~5 MB localStorage budget.\n\nOnce the budget is exhausted, any other persisted Zustand store whose `setItem` is called next throws `QuotaExceededError`.\n\n## Reproduction (Chromium-based browser, ~5 MB origin cap)\n\n1. Open the workflow editor.\n2. Add an agent block and paste a large system prompt (e.g., 5 KB of text).\n3. Delete and re-add the block several times. Each cycle pushes `batch-add-blocks` and `batch-remove-blocks` operations whose snapshots include the full block state.\n4. Across a few workflows (up to 5 stacks as `MAX_STACKS` allows), the localStorage origin reaches the cap.\n5. Take any action that triggers another store's persist (e.g., select a block, dismiss a notification). The next `setItem` throws `QuotaExceededError`.\n\nMeasurement helper for the console:\n\n\\`\\`\\`js\nconst sizes = Object.keys(localStorage).map(k => [k, localStorage.getItem(k)?.length ?? 0])\nconsole.table(sizes.sort((a, b) => b[1] - a[1]))\n\\`\\`\\`\n\nshows `workflow-undo-redo` occupying the bulk of origin storage in the affected state.\n\n## Existing partial mitigations\n\n- **PR #2079** added an inline `safeStorageAdapter` to undo-redo's persist middleware, swallowing the quota throw silently for that store — but it does not free the origin budget that other small stores share, so those still throw uncaught.\n- **PR #2812** moved `terminal-console-store` from localStorage to IndexedDB for the same reason (large data).\n- **PR #497** explicitly stated the policy to \"remove use of local storage except for oauth and last active workspace id\". The later introduction of undo-redo's localStorage persistence diverged from that policy.\n\n## Proposed fix\n\nMigrate \\`workflow-undo-redo\\` to IndexedDB using the same \\`idb-keyval\\` pattern as \\`terminal-console-store\\` (PR #2812), including a one-time migration that copies any existing data and removes the legacy localStorage key on first module load. PR follows.","author":{"url":"https://github.com/Sprexatura","@type":"Person","name":"Sprexatura"},"datePublished":"2026-05-26T08:19:32Z","url":"https://github.com/simstudioai/sim/issues/4737"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1c320ba5-5951-e337-c28a-af66833b2815 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE38:F482B:3F8E0F:58D2D8:6AFB597C |
| html-safe-nonce | 321b4d081fa0f305497677814be3165b1d449d785fd5a2f7e40e25e0ac9fcfd2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTM4OkY0ODJCOjNGOEUwRjo1OEQyRDg6NkFGQjU5N0MiLCJ2aXNpdG9yX2lkIjoiNTkxMTU2ODg2NzQ3MjkyMzAwNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 983ef225eb414b80594c7672f6a56b955e47358d843e7f9da1c4e7aca81354a5 |
| hovercard-subject-tag | issue:4522622349 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/simstudioai/sim/4737/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04da45c0203a6257d27f200fc91fac1c5d79692caf69772cf2ee752e5f6a5820/simstudioai/sim/issues/4737 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04da45c0203a6257d27f200fc91fac1c5d79692caf69772cf2ee752e5f6a5820/simstudioai/sim/issues/4737 |
| og:image:alt | Summary A QuotaExceededError: Failed to execute 'setItem' on 'Storage' can surface from various small Zustand-persisted stores (e.g., notification-storage, panel-editor-state) when a user has activ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Sprexatura |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width