Repository navigation
Fix #2469: Funktionspläne: Blocks were updated. Reload admin? - #2473
Open
GermanBluefox wants to merge 1 commit into
Open
GermanBluefox wants to merge 1 commit into
GermanBluefox wants to merge 1 commit into
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The editor asked "Some blocks were updated. Reload admin?" on every change of an object under
system.adapter.*that hascommon.blockly- also of an instance, because an instance carriescommon.blocklyof its adapter. Starting or stopping an instance changes its object (common.enabled), so the diagram in the issue, which writessystem.adapter.cloud.0.alivethrough 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.tsnotes which versions were loaded (rememberLoadedBlocks(), called fromBlocklyEditor.loadCustomBlockly()), andApp.onInstanceChanged()asks only whenblocksNeedReload()says so:common.blocklywhose 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, soAppchecks it without loading Blockly. Vitest tests insrc-editor/src/Components/__tests__/blocklyAdapters.test.ts.Fixes #2469
🤖 Generated with Claude Code