Skip to content

Goods editor: custom uploaded icons missing from icon picker after reload #35

Description

@barrulus

Found while answering a Discord question about goods icons (research spec: docs/superpowers/specs/2026-08-24-discord-cultures-ice-goods-answer.md).

Symptom

Upload a custom SVG (or raster) icon in the good editor, save the map, reload it, reopen the good editor: the custom icon no longer appears in the icon dropdown. Goods already assigned to it still render correctly — persistence itself works (custom defs are serialized in save slot 45, src/services/io/save.ts:132-137, and reinjected on load, src/services/io/load.ts:427-431).

Cause

The icon picker enumerates only <symbol> elements:

  • src/controllers/good-editor.ts:12 — options built from #good-icons via querySelectorAll("symbol")
  • src/controllers/good-editor.ts:502-560uploadImage appends the uploaded file as an <svg> element (id good-custom-*), not a <symbol>

Within the upload session the option is manually appended (good-editor.ts:481), which masks the mismatch until the next reload.

Fix options

  • One-liner: enumerate symbol, svg at good-editor.ts:12, or
  • Wrap uploads as <symbol> in uploadImage (more consistent with the 72 built-in defs, but check existing maps carrying <svg>-shaped custom defs still resolve — <use> accepts both).

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions