BubbleSpace の hook:依存漏れ・ドラッグ中の全描き直し・副作用の後始末

Open
#202 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 12 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript

Research direction

Start with the linked sections of BubbleSpace.tsx, then read useBubbleInput.ts, BubbleField.tsx, useSpaceViewState.ts, and ShoreSpace.tsx at the cited locations. Check the hook tests (the issue says none exist) and trace the reported dependencies, drag rendering, cleanup, preset synchronization, and external-world path. Done means the agreed fixes or removal are covered by tests, including lifecycle and repeated updates.

Written by the indexing model from the issue text.

Description

OS question

bubble-layout-feature の BubbleSpace と周りの hook で、React の依存・副作用・描き直しの量に関するものです。いちばん壊れやすい所なのに hook のテストが 1 本も無いので、あわせて足したいです。

1. useCallback / useMemo の依存漏れ

  • BubbleSpace.tsx:652(openBubble):listHosts が依存に無い。海の記憶から戻して listHosts だけ増えたとき、札から開くと一覧の「中」に開き、次の setChildren で extra として消される(focusOn が新しい世界を返すなら自然に直るので要確認)
  • BubbleSpace.tsx:1293(renderBubble):dressed / base / openArea / chooseView / toggleFollows が依存に無い。選択だけ変わって世界が変わらないと bl-grown が付かず、中身の開始位置が 27px ずれる(要確認)
  • useBubbleInput.ts:617:o.dressed / o.onDragInfo(影響は小)

2. ドラッグ中の 1 フレームごとに、木ぜんぶが描き直される(性能)

setWorld のたびに:api(openBubble などが world に依存)が新しくなる → renderBubble が作り直され、全部の泡の route.Component が描き直される → LegacyScreen の legacyContext(space に依存)を読む中身も全部 → ShoreSpace は onReady から setSpace を受けるので自分ごと。窓の入れ子や重い旧画面が多いとカクつく。

3. useMemo の中の副作用・後始末

  • noTween(BubbleSpace.tsx:541-548)が useMemo の中で ref を書き換えている
  • overscroll の rAF をアンマウント時に止めていない(BubbleSpace.tsx:506-518)
  • 帯のホバーが解けない(BubbleField.tsx:79-82, 114-115):層から外へ出たとき pointerout の target(泡)が残るので hoveredId が解けず、帯が出たままになる

4. 並べ方の口が世界と同期しない

  • useSpaceViewState.ts の preset は世界から同期されないので、世界線で戻してもセレクトが古いまま
  • ShoreSpace.tsx:483 の setPreset が spaceId を渡していない

5. 使っていない「外で世界を持つ」経路が壊れている

BubbleSpace.tsx:429-435:onChange のとき関数での書き込みを worldRef.current から作るので、同じ拍の 2 回目が 1 回目を消す。restore(:395)は依存が [] で古い setWorld を掴む。いまは誰も world / onChange を渡していないので、直すか消す。

(行番号は main d41a42da 時点)

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from fumicode/bublys-org

All issues in fumicode/bublys-org

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.