GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Document importmap_watches and loading custom Arbre components by senid231 · Pull Request #9156 · activeadmin/activeadmin

Conversation

@senid231

@senid231 senid231 commented Nov 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Documents how to add JavaScript to Active Admin pages from an engine and how to load custom Arbre components.

Depends on #9148 and on #9153. This branch contains their commits; only the last two commits belong to this PR. I'll rebase it after they merge.

  • The engine example in the "JavaScript modules" section also appends to importmap_watches. It notes that Propshaft serves an engine's vendor/javascript only if the engine adds it to the asset paths.
  • A paragraph explains config.importmap_watches for modules that the host app pins, and says to append to it from an initializer because a later append raises.
  • "Custom components" in the Arbre docs explains why a component that calls builder_method must load before the register blocks that use it. It recommends eager-loading the component directory in config.to_prepare, and requiring files under lib/ from the same block.

Part of #9147.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@codecov

codecov Bot commented Nov 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (e1dad93) to head (e427785).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9156   +/-   ##
=======================================
  Coverage   99.11%   99.11%           
=======================================
  Files         139      140    +1     
  Lines        4071     4089   +18     
=======================================
+ Hits         4035     4053   +18     
  Misses         36       36           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@senid231 senid231 mentioned this pull request Nov 4, 2026
Theme 4.0 for ActiveAdmin 4 activeadmin-plugins/active_admin_theme#78
Draft
17 of 22 tasks
@senid231
senid231 force-pushed the docs-javascript branch from 25fd1d6 to b57f1b5 Compare November 4, 2026 21:43
senid231 added 3 commits November 12, 2026 13:20
@senid231
Add javascript_modules setting to import modules on every page
0ede3bd
Active Admin pages render only ActiveAdmin.importmap and import only its
active_admin entry point, so a module pinned in the host's importmap loads
nothing. Themes and plugins copied _html_head to add their imports.

Co-Authored-By: Clanker
@senid231
Keep javascript_modules separate per application
9e30427
The setting default is one shared array, so appending to it leaked into every later Application.

Co-Authored-By: Clanker
@senid231
Read javascript_modules once and merge the import steps
184daec
Co-Authored-By: Clanker
@senid231
senid231 force-pushed the docs-javascript branch from b57f1b5 to da7fb10 Compare November 12, 2026 11:55
senid231 added 5 commits November 12, 2026 14:08
@senid231
Add importmap_watches setting for the import map cache sweeper
eb885de
Importmap::Map#cache_sweeper(watches:) builds a new watcher on each call,
so an engine that passed its own directory replaced ActiveAdmin's. The
sweeper is now built once in after_initialize from this list, which
engines and config/initializers can extend.

Co-Authored-By: Clanker
@senid231
Guard the sweeper call and test edits to watched files
2cdbdbb
A request made from an earlier after_initialize hook ran before the
sweeper existed. The spec now edits an existing file instead of relying
on a new one, and restores the boot-time sweeper.

Co-Authored-By: Clanker
@senid231
Raise when importmap_watches is appended after boot
196b804
The sweeper reads the list once in after_initialize, so a directory
added later, for example from to_prepare, was silently never watched.

Co-Authored-By: Clanker
@senid231
Document importmap_watches and loading custom Arbre components
993de66
builder_method runs when the component class loads, and nothing
references the class constant, so autoloading never loads it before the
register blocks that use it.

Co-Authored-By: Clanker
@senid231
Fix engine root and importmap_watches timing in the docs
15b92bd
Rails runs to_prepare blocks on the reloader, so a bare root is
undefined there, and appends to importmap_watches made after
after_initialize never reach the sweeper.

Co-Authored-By: Clanker
@senid231
senid231 force-pushed the docs-javascript branch from 24978a7 to 15b92bd Compare November 12, 2026 12:09
@senid231
Freeze importmap_watches without a custom error module
e427785
A plain frozen array already rejects late appends. The setting's comment
now says to append from an initializer.

Co-Authored-By: Clanker

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@senid231
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.