Skip to content

Register the recent-entries widget in window.openStationWidgets - #60

Merged
AllTerrainDeveloper merged 1 commit into
AllTerrainDeveloper:mainfrom
juanlentino:fix/widget-registry
Sep 26, 2026
Merged

AllTerrainDeveloper merged 1 commit into
AllTerrainDeveloper:mainfrom
juanlentino:fix/widget-registry

Conversation

@juanlentino

Copy link
Copy Markdown
Contributor

Fixes #59.

OpenStation looks up widget mount callbacks by id in window.openStationWidgets (window.desktopModeWidgets on older Desktop Mode builds). src/widget.ts only exported render, which the IIFE build places at window.allTerrainFormsWidget.render, so the shell never found allterrain-forms/recent and logged a mount failure on every desktop load.

Change

  • src/widget.ts registers the existing renderWidget under allterrain-forms/recent. It merges into whichever registry already exists and never replaces it, since other plugins' widgets live in the same object.
  • The render export stays, so mountStandalone and anything reading the IIFE global keep working. The registry is a different global from the one the IIFE's final assignment overwrites, so the hand-assignment issue described in the existing comment doesn't apply. That comment is updated to say so.
  • assets/js/widget.js and widget.min.js are rebuilt with npm run build:widget.

Verified

  • npm run typecheck: clean.
  • npm test: 469 passed, 2 skipped.
  • Ran the built widget.min.js against a stub window that already held another plugin's widget. Afterward openStationWidgets held both keys (other/w, allterrain-forms/recent), and desktopModeWidgets pointed at the same object.

Not tested in a live OpenStation desktop yet.

…Widgets

OpenStation looks up mount callbacks by id in window.openStationWidgets
(window.desktopModeWidgets on older Desktop Mode builds). The widget only
exported render on window.allTerrainFormsWidget, so the shell never found
it and logged a mount failure on every desktop load.

Fixes AllTerrainDeveloper#59

@AllTerrainDeveloper AllTerrainDeveloper left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Juan. I checked this against OpenStation’s widget loader: it reads openStationWidgets by widget ID, and this registers the existing mount callback while preserving the other widgets and the standalone export. The CI checks are green. Nice fix.

@AllTerrainDeveloper
AllTerrainDeveloper merged commit f87c619 into AllTerrainDeveloper:main Sep 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants