Skip to content

Fix #2469: Funktionspläne: Blocks were updated. Reload admin? - #2473

Open
GermanBluefox wants to merge 1 commit into
masterfrom
fix/issue-2469-blocks-reload
Open

GermanBluefox wants to merge 1 commit into
masterfrom
fix/issue-2469-blocks-reload

Conversation

@GermanBluefox

Copy link
Copy Markdown
Contributor

The editor asked "Some blocks were updated. Reload admin?" on every change of an object under system.adapter.* that has common.blockly - also of an instance, because an instance carries common.blockly of its adapter. Starting or stopping an instance changes its object (common.enabled), so the diagram in the issue, which writes system.adapter.cloud.0.alive through STATE_OUT, made the question pop up on every restart of the script and on every change of its trigger.

The blocks of the adapters are loaded once, when the first Blockly script is opened, so a reload is needed only when an adapter with blocks is updated or newly installed. The new module src-editor/src/Components/blocklyAdapters.ts notes which versions were loaded (rememberLoadedBlocks(), called from BlocklyEditor.loadCustomBlockly()), and App.onInstanceChanged() asks only when blocksNeedReload() says so:

  • instance objects never lead to the question;
  • not before blocks were loaded at all - the next Blockly script loads them as they are;
  • only for an adapter object with common.blockly whose version differs from the loaded one, and once per version (installing writes the adapter object more than once).

The module is kept apart from BlocklyEditor, so App checks it without loading Blockly. Vitest tests in src-editor/src/Components/__tests__/blocklyAdapters.test.ts.

Fixes #2469

🤖 Generated with Claude Code

The editor asked "Some blocks were updated. Reload admin?" on every change
of an object under system.adapter.* with common.blockly - also of an
instance, which carries common.blockly of its adapter. Starting or stopping
an instance changes its object, so a diagram writing
system.adapter.cloud.0.alive made the question pop up each time.

The question now comes only when blocks are loaded and an adapter object
with blocks shows a version the page does not have yet (an update or a new
adapter), once per version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Funktionspläne: Blocks were updated. Reload admin?

1 participant