Skip to content

file-uploader.tsx: object URL for the selected file preview is never revoked #868

Description

@YusukeHirao

発見の経緯

ERM (Explicit Resource Management) 導入作業(using/Symbol.dispose 導入、PR で @d-zero/tools の ERM ヘルパー採用)の事前調査で見つかったスコープ外項目。

内容

packages/@burger-editor/client/src/components/file-uploader.tsx:46 付近で URL.createObjectURL() を呼んでプレビュー用の blob URL を生成しているが、URL.revokeObjectURL() が呼ばれていない。

componentObserver.notify('file-select', { path }) で下流にプレビュー URL が流れる構造上、アップロード完了後もいつ revoke すべきかの寿命設計が単純な using では解決できない(コンポーネントのライフサイクルと URL の生存期間が一致しない)。

対応方針(要検討)

  • プレビュー URL の所有者・寿命を明確化した上で、アップロード完了時 or コンポーネントのクリーンアップ時に revoke する設計を検討する

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions