Repository navigation
Load daisyUI and Headless UI at runtime for searchable Guild WebUI selects - #85
Merged
Merged
Conversation
…archable without vendoring libraries or changing the pale-blue theme.
…sible input, and portal option lists so the guild picker is not clipped.
… loads. daisyUI defines those same class names as stacked grid/flex components, which overlapped the dashboard chrome.
…croller. The CDN stylesheet hid :root overflow and reserved a stable gutter, and the fixed 100vh sidebar added a second scrollbar; the workspace now fills the viewport as one flex page.
…its tokens. First-party CSS was restyling hero, stats, cards, and nav back into the old SPA look. Keep the existing colors as daisyUI theme variables and use the library's menu, navbar, stats, join, alert, and card components instead.
…n both themes. The searchable control used a navy join button inside a nested sidebar card, which read as a foreign widget. Reuse the same select chrome as the rest of the shell.
daisyUI navbar flex-1 left the save-status overlapping the server name; space-between plus a dedicated title block keeps them apart. Appearance belongs with the account controls at the bottom of the sidebar.
jatmn
marked this pull request as ready for review
September 22, 2026 14:12
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="frontend/index.html" line_range="19-29" />
<code_context>
document.documentElement.dataset.theme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
}
</script>
+<script>
+window.JMODGUARD_DAISYUI_HREF = window.JMODGUARD_DAISYUI_HREF || "https://cdn.jsdelivr.net/npm/daisyui@5.7.43/daisyui.css";
+window.JMODGUARD_ESM_BASE = window.JMODGUARD_ESM_BASE || "https://esm.sh";
+</script>
+<link rel="stylesheet" id="jmodguard-daisyui" href="https://cdn.jsdelivr.net/npm/daisyui@5.7.43/daisyui.css">
+<script>
+(function () {
+ const link = document.getElementById("jmodguard-daisyui");
+ if (link && window.JMODGUARD_DAISYUI_HREF && link.getAttribute("href") !== window.JMODGUARD_DAISYUI_HREF) {
+ link.href = window.JMODGUARD_DAISYUI_HREF;
+ }
+})();
+</script>
</code_context>
<issue_to_address>
**issue (bug_risk):** The documented daisyUI stylesheet override is applied only after the default stylesheet link has already been created and its IIFE has already run. An operator setting `window.JMODGUARD_DAISYUI_HREF` before `app.js`, as documented, but after the head section cannot replace the default stylesheet, so the configured CDN is ignored for CSS.
**Triggers:** When the override is injected in the usual page configuration location before `app.js` but after the existing head markup.
**Suggested fix:** Set the link's initial `href` from `window.JMODGUARD_DAISYUI_HREF` before creating the link, or move the override/configuration point before the stylesheet link and document that ordering explicitly.
</issue_to_address>
### Comment 2
<location path="frontend/app.js" line_range="296-299" />
<code_context>
+ import(`${esm}/react-dom@${reactV}/client?deps=react@${reactV}`),
+ import(`${esm}/@headlessui/react@${headlessV}?deps=react@${reactV},react-dom@${reactV}`),
+ ]).then(([reactMod, reactDomMod, headlessMod]) => {
+ const React = vendorModule(reactMod, ["createElement", "useState"]);
+ const ReactDOM = vendorModule(reactDomMod, ["createRoot"]);
+ const Headless = vendorModule(headlessMod, ["Combobox", "ComboboxInput", "ComboboxOptions", "ComboboxOption"]);
+ if (typeof React?.createElement !== "function" || typeof ReactDOM?.createRoot !== "function" || !Headless?.Combobox) {
+ throw new Error("vendor runtime missing Combobox exports");
+ }
</code_context>
<issue_to_address>
**issue (bug_risk):** The runtime validation checks only `Headless.Combobox`, but `makeSearchSelect` unconditionally passes `ComboboxInput`, `ComboboxOptions`, and `ComboboxOption` to `React.createElement`. A partially incompatible or incorrectly cached Headless UI override therefore throws during widget rendering while the native select remains marked as enhanced and hidden, so the fallback select is not restored.
**Triggers:** When the configured ESM host serves a Headless UI module with `Combobox` but without one of the other required Combobox exports.
**Suggested fix:** Validate every required Headless export before mounting, and attach an error boundary or synchronous render failure path that calls `restoreNativeSelect`.
</issue_to_address>
### Comment 3
<location path="frontend/app.js" line_range="286-305" />
<code_context>
+function loadSearchSelectRuntime() {
</code_context>
<issue_to_address>
**nitpick (bug_risk):** A failed runtime import is cached as a rejected `vendorRuntimePromise`, so every subsequent enhancement attempt immediately fails even if the CDN becomes reachable later. The searchable controls remain native for the rest of the page lifetime after one transient vendor-load failure, with no retry path.
**Triggers:** When the initial CDN request fails transiently and the operator later regains connectivity without reloading the page.
**Suggested fix:** Clear `vendorRuntimePromise` in the rejection path or add an explicit retry that creates a fresh import promise.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 2 findings to address first, and this adds remote JavaScript dependencies from esm.sh to an authenticated admin UI, creating a new runtime trust boundary: a compromised or incorrect CDN module could read dashboard data or issue API mutations as the signed-in user. Reverting prevents future exposure, but any data disclosed or actions performed before the revert cannot be undone.
Blocking findings: frontend/index.html:29, frontend/app.js:299
…ete Combobox exports. The head IIFE never saw an override placed before app.js, and a partial Headless module could hide the native select. Fail closed before mount instead of adding CDN retry.
…box lists above modals. A hardcoded stylesheet href still fetched jsDelivr when the override sat above the link, and portaled options sat under daisyUI modal stacking.
3 of 6 tasks
This was referenced Dec 3, 2026
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.
Summary
window.JMODGUARD_DAISYUI_HREFandwindow.JMODGUARD_ESM_BASE). Library source is not vendored in git.--color-*aliases map to them. Native<select>remains if the vendor runtime cannot load. Bunny/embed publication stays the three first-party files.Test plan
node --test scripts/frontend-state-test.mjs(pins, theme tokens, vm does not fetch CDN modules)node --test scripts/frontend-warmup-test.mjsnode --test scripts/publish-frontend-test.mjs(still three files)bash scripts/ci-preflight.shon this headindex.html,app.js,style.cssFinal reviewed SHA:
71a1916b585bfe62ff861de171c6e56dd37a2645Summary by Sourcery
Enable searchable Guild WebUI selects with runtime daisyUI and Headless UI dependencies while preserving the existing theme, native fallback, and lightweight frontend distribution.
New Features:
Bug Fixes:
Enhancements:
Deployment:
Documentation:
Tests: