Surface htmx errors in admin UI#16
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA single template file gains a ChangesHTMX Inline Error Display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a7a8d3bc7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| document.addEventListener("htmx:beforeSwap", function (event) { | ||
| var detail = event.detail || {}; | ||
| var xhr = detail.xhr; | ||
| if (!xhr || xhr.status < 400) return; |
There was a problem hiding this comment.
Clear stale inline errors after successful retries
Because this handler returns before finding/removing any existing .admin-inline-error for all <400 responses, a transient htmx failure can leave a stale alert after the user retries successfully. For example, the Refresh catalog button in internal/adminapi/templates/index.html swaps only #models-content, while this handler prepends the error to the surrounding .card__body; a successful retry replaces #models-content but never removes that sibling alert, so the UI continues to show the old failure. Clear the host's prior error before this return or on successful swap.
Useful? React with 👍 / 👎.
Summary
Tests
Summary by CodeRabbit