Skip to content

Fix: open a widget's settings from its own config, not the last one edited - #128

Merged
SandObserver merged 1 commit into
mainfrom
fix/widget-form-shows-previous-widget
Aug 18, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/widget-form-shows-previous-widget

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Add carriesTypedValues to admin-logic.js: typed values are carried only into a re-render of the same form in the same editing session.
  • Stamp an editor session in admin.js when the edit view opens an item, and record it alongside the cached form in admin-widget-form.js.
  • Match the cache on that session as well as the widget type, so a second widget of the same type opens from its own saved config.

The cache was matched on widget type alone and was never cleared between openings, so _wAutoCfg was overwritten by the previously edited widget's form values. With several widgets of one type on a dashboard, the settings showed another tile's provider, URL and slots, and saving would have persisted them against the wrong tile's stored secret.

Keying to the session rather than clearing the cache preserves the case that made it exist: switching the type tiles inside an open editor re-renders the body and must not discard what was typed.

Testing
All green. Added 1 test covering the same-form, next-widget, different-type and empty-cache cases. Verified in a container with four system-summary tiles, opening them in sequence.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

…dited

The config form keeps values typed into it across a re-render, so a view switch
does not discard them. That cache was matched on widget type alone and outlived
the editor, so opening a second widget of the same type filled its form from the
first: a tile reading one source showed another as its source, and saving would
have written it.

The cache now belongs to one opening of the editor. Switching type tiles inside
an open editor still keeps what was typed, which clearing the cache outright
would have discarded.
@SandObserver SandObserver added the bug Something isn't working label Aug 18, 2026
@SandObserver
SandObserver merged commit fb000f8 into main Aug 18, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/widget-form-shows-previous-widget branch August 18, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant