Skip to content

Migrate alchemy-select to tom-select#3931

Merged
tvdeyen merged 5 commits into
mainfrom
migrate-alchemy-select-to-tom-select
Jun 3, 2026
Merged

Migrate alchemy-select to tom-select#3931
tvdeyen merged 5 commits into
mainfrom
migrate-alchemy-select-to-tom-select

Conversation

@tvdeyen
Copy link
Copy Markdown
Member

@tvdeyen tvdeyen commented Jun 1, 2026

What is this pull request for?

Migrate the alchemy-select customElement from using select2 to tom-select.
It keeps the features, but reimplements them in tom-select.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 8.3 milestone Jun 1, 2026
@tvdeyen tvdeyen requested a review from a team as a code owner June 1, 2026 15:32
@tvdeyen tvdeyen added the enhancement New feature or enhancement label Jun 1, 2026
@tvdeyen tvdeyen force-pushed the migrate-alchemy-select-to-tom-select branch 4 times, most recently from 041ea3a to 8082de7 Compare June 3, 2026 07:15
Copy link
Copy Markdown
Contributor

@sascha-karnatz sascha-karnatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome!

@tvdeyen tvdeyen force-pushed the migrate-alchemy-select-to-tom-select branch 2 times, most recently from 9b0aece to e851707 Compare June 3, 2026 08:44
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.15%. Comparing base (da6ef12) to head (c74be87).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3931   +/-   ##
=======================================
  Coverage   98.15%   98.15%           
=======================================
  Files         343      343           
  Lines        8899     8911   +12     
=======================================
+ Hits         8735     8747   +12     
  Misses        164      164           

☔ View full report in Codecov by Sentry.
📢 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.

@tvdeyen tvdeyen force-pushed the migrate-alchemy-select-to-tom-select branch from e851707 to 64f0a72 Compare June 3, 2026 09:15
tvdeyen added 5 commits June 3, 2026 11:37
The basic enhanced select (`<select is="alchemy-select">`) is the simplest of
the Select2 usages and a good first step toward dropping jQuery. Tom Select is
a maintained, dependency-free library that wraps the native select, so the
component keeps its public API (setOptions, enable, disable, allowClear) and
every render site stays unchanged.
Instead of bundling floating-ui into two bundles,
we share it as it's own bundle between shoelace
and alchemy-select.
We only want to autofocus the element select
inside of the new element form, not anywhere
else (ie. the styleguide).
If we open a select in the elements window
and the popup opens to the top off the window,
we must not cut-off the content. For this to
work well, we need to move the top bar below the
main_content, because it is fied and would cut-off
the elements window.
The importmap cache_sweeper only watched the JavaScript source directories, but the importmap pins resolve to the bundled files in app/assets/builds. After a rebuild the cached importmap kept emitting the previous asset digest, so the browser requested a digest that no longer existed and the asset returned a 404 until the server was restarted. Watching the build output directory sweeps the cache on every rebuild so the importmap always resolves the current digest.

Watching the source directories was misleading because it is enough for a plain importmap setup where the pins point at the source files themselves, but Alchemy bundles its admin JavaScript with rollup into a separate output directory.
@tvdeyen tvdeyen force-pushed the migrate-alchemy-select-to-tom-select branch from 64f0a72 to c74be87 Compare June 3, 2026 09:37
@tvdeyen tvdeyen enabled auto-merge June 3, 2026 09:37
@tvdeyen tvdeyen merged commit 2fd2048 into main Jun 3, 2026
26 of 28 checks passed
@tvdeyen tvdeyen deleted the migrate-alchemy-select-to-tom-select branch June 3, 2026 09:45
@alchemycms-bot alchemycms-bot Bot mentioned this pull request Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants