Problem/Motivation
On a fresh Varbase build, or after generating a sub-theme and switching the default theme, the Drupal Canvas page editor can fail to open a page (HTTP 500 / "requested version is not available", or an AssertionError during component hydration), and the log fills with "Component version … not found, falling back to active version" warnings.
Root cause: Canvas regenerates its SDC component config entities on cache rebuild, module install and theme install — createVersion() records the new active version and deleteVersionIfExists() drops the previous one. Any config or content (demo content, content templates, migrated component trees) that still pins the previous version hash is left stale. Page render tolerates this (it falls back to the active version), but the Canvas editor surfaces the mismatch.
varbase_components already heals stale versions on theme switch (ActiveThemeChangeSubscriber) and via the varbase-components:fix-versions Drush command, but the synchronous switch heal runs before the new theme's components are regenerated, and a fresh build never runs the Drush command — so stale versions survive and the editor breaks.
Steps to reproduce
- Fresh Varbase install; generate and build a sub-theme; set it as the default theme.
- Open a Canvas page in the editor — it returns a 500 / version-not-available, with stale-version warnings in the log.
Proposed resolution
- Add a public heal() entrypoint on ActiveThemeChangeSubscriber that runs the existing full-scope repair (fixComponentVersionsInConfigs + fixComponentVersionsInContentEntities) after resetting the component storage cache.
- Invoke it automatically — after Canvas has regenerated components — from hook_rebuild, hook_modules_installed and hook_themes_installed.
- Add varbase_components.install to set the module weight heavier than Canvas, so the heal always runs after component regeneration. Idempotent; a no-op when nothing is stale or when Canvas is not installed.
Remaining tasks
- ✅ File an issue about this project
- ❌ Addition/Change/Update/Fix to this project
- ❌ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Code review from 1 Varbase core team member
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ❌ Update Release Notes and Update Helper on new feature change/addition
- ❌ Release
Varbase update type
- ➖ No Update
- ✅ Optional Update
- ➖ Forced Update
- ➖ Forced Update if Unchanged
User interface changes
- N/A
API changes
- Adds a public heal() method to ActiveThemeChangeSubscriber; adds rebuild/modules_installed/themes_installed hooks and a module-weight install hook. No breaking API change.
Data model changes
- N/A
Release notes snippet
- Drupal Canvas component versions now self-heal automatically after a fresh build, module install, theme install or cache rebuild, so the Canvas page editor keeps working after generating and switching to a custom sub-theme.
AI usage disclosure
AI-Generated: Yes — an AI assistant helped root-cause this issue and draft the fix and this summary; all changes were reviewed and tested by the contributor on Drupal 11 + Varbase 11, per the AI contribution policy.
Issue fork varbase_components-3605988
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahComment #6
rajab natshah✅ Released varbase_components-4.0.0-beta1