localStorage が溢れる ── 世界線の cas を IndexedDB と二重に持っている
Maintainers usually reply within 12 days
@ninjamasa is already working on this.
Since Oct 7, 2026.
Assessment
This issue has not been assessed yet.
Description
何が起きているか
localStorage の persist:root(redux-persist が Redux の状態を書く所)が、ブラウザの上限(約 5MB)に達して書けなくなる。
Error storing data QuotaExceededError: Failed to execute 'setItem' on 'Storage':
Setting the value of 'persist:root' exceeded the quota.
溢れると、それ以降の変更(どのスライスも)が保存されない。リロードすると、溢れる前の状態に戻る。
中身
ふだん使っているブラウザで測った値:
| 大きさ | |
|---|---|
persist:root 全体 |
約 5.2MB |
└ worldLineGraph |
約 4.4MB |
| └ ほかのスライス全部 | 数 KB |
ほとんどが世界線の cas(各節の中身の控え)。
なぜ溢れるか
世界線の中身は 2 か所に置かれている。
世界線を伸ばす
│
├─→ Redux の cas(最大 300 件。古いものから捨てる = 手元の控え)──→ localStorage(redux-persist)
│
└─→ IndexedDB(world-line-graph-db。全部ずっと残る = 本当の置き場)
↑ 控えから捨てた節が要る時は、ここから取ってくる(useCasScope)
- 本当の置き場は IndexedDB(
worldLineGraphListener.tsが全部書いている) - Redux の
casは控えで、MAX_CAS_ENTRIES = 300を超えたら古いものから捨てる(worldLineGraphSlice.ts) - その控えを、redux-persist が localStorage にも丸ごと書いている ── 二重持ち
上限は件数で決めていて、1 件の大きさを見ていない。海の姿(sea-arrangement)は 1 節で 100〜200KB ある(泡が 200 個、一覧の札まで全部入る)ので、海の節が 30〜50 個たまるだけで 5MB に届く。
直し方の案
- A.
casを localStorage に書かない(おすすめ)
IndexedDB に全部あるので、書かなくても失うものはない。グラフ(節の DAG)は小さいので、これまでどおり persist してよい。
リロード直後は控えが空なので IndexedDB から取ってくる ──useCasScopeのpendingがもうこの場面(「参照はあるのに値が手元に無い」)を扱っている。
redux-persist の transform か、worldLineGraphを入れ子の persist にしてcasだけ blacklist する形になりそう。 - B. 上限を件数ではなく大きさで決める
二重持ちは残るので、根本の手当てにはならない。
確かめること
casを書かなくしたあと、リロードして海・囲碁・メモの世界線がそのまま戻る- 「はじめて開いた人」の見本の海(
useSeedOnFirstOpen/worldLineSeed)が、記録の無い時だけ撒かれる(グラフの読み戻しで「はじめて」を判断しているので、グラフは persist し続ける必要がある) - すでに溢れているブラウザで開いても、壊れずに直る
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 9d 13h
- Merged PRs (30d)
- 10
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from fumicode/bublys-org
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
fumicode/bublys-org#261 ·
Maintainers usually reply within 12 days
-
enhancement Shiftonton
Difficulty 5/5 Over a week Newbie friendliness 15/100
fumicode/bublys-org#259 ·
Maintainers usually reply within 12 days
-
enhancement Shiftonton
Difficulty 3/5 1-2 days Newbie friendliness 42/100
fumicode/bublys-org#258 ·
Maintainers usually reply within 12 days
-
enhancement Shiftonton
Difficulty 4/5 3-5 days Newbie friendliness 25/100
fumicode/bublys-org#257 ·
Maintainers usually reply within 12 days
-
enhancement Shiftonton
Difficulty 4/5 3-5 days Newbie friendliness 55/100
fumicode/bublys-org#256 ·
Maintainers usually reply within 12 days
All issues in fumicode/bublys-org
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
External sources always come back in English: `lc` isn't passed to `/api/v3/external_sources`Possibly taken @Anurag1428 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
openfoodfacts/openfoodfacts-explorer#2264 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
cloudflare/workers-sdk#17139 ·
Maintainers usually reply within 1 day
-
area: editor P3 type: feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
halisonworks/mod-codeling#290 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
colinhacks/zod#6776 ·
Maintainers usually reply within 1 day