stack/apps/dashboard/src/components
Mantra 10df9b2b7b
Fix dashboard sandbox compile errors and switch smart model to Grok (#1476)
## Summary
- Forward Babel/JSX compile errors, runtime throws, and unhandled
rejections from the AI dashboard sandbox iframe to the parent composer
via `postMessage`, so users see actionable errors instead of a blank
preview
- Compile AI-generated dashboard source explicitly with
`Babel.transform` + try/catch (stored in `text/plain` to avoid Babel's
auto-handler swallowing parse errors) and add `crossorigin="anonymous"`
on the Babel script for readable cross-origin error messages
- Switch authenticated smart-tier model from
`moonshotai/kimi-k2.6:nitro` to `x-ai/grok-build-0.1`

## Test plan
- [ ] Generate a dashboard with valid AI code and confirm the preview
still renders
- [ ] Generate a dashboard with invalid JSX and confirm the composer
shows the compile error (not a blank iframe)
- [ ] Trigger a runtime error in generated dashboard code and confirm it
reaches the parent error boundary
- [ ] Verify authenticated smart-tier requests route to
`x-ai/grok-build-0.1`


Made with [Cursor](https://cursor.com)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Embedded dashboards now show a clear “Dashboard failed to compile”
message on compilation errors instead of a blank iframe.
* Dashboard runtime errors and unhandled promise rejections are captured
earlier and forwarded to the parent for improved visibility.

* **Updates**
* The authenticated AI model used for the "smart" quality has been
changed, affecting model selection for authenticated requests.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/hexclave/stack-auth/pull/1476?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-23 12:34:37 -07:00
..
assistant-ui Compress oversized images client-side in AI chat (#1456) 2026-05-21 12:57:20 -07:00
commands Fix dashboard sandbox compile errors and switch smart model to Grok (#1476) 2026-05-23 12:34:37 -07:00
data-table Onboarding app redesign (#1370) 2026-05-20 13:10:22 -07:00
design-components Payments app design fixes (#1375) 2026-05-21 14:48:56 -07:00
form-fields [UI] - Updates all Icons to Phosphor Icons (#1066) 2025-12-22 10:43:45 -06:00
pacifica Cmd K (#1037) 2025-12-04 10:03:21 -08:00
payments Payments app design fixes (#1375) 2026-05-21 14:48:56 -07:00
rule-builder Enhance error handling and logging in Emailable response validation (#1292) 2026-04-01 09:21:43 -07:00
stack-companion refactor(dashboard): unify AI chat surfaces on assistant-ui Thread (#1427) 2026-05-15 14:21:00 -07:00
ui Payments app design fixes (#1375) 2026-05-21 14:48:56 -07:00
vibe-coding refactor(dashboard): unify AI chat surfaces on assistant-ui Thread (#1427) 2026-05-15 14:21:00 -07:00
walkthrough Speed up dummy-project seeding (preview create-project ~15s → ~1.3s) (#1437) 2026-05-20 10:10:22 -07:00
app-square.tsx [codex] Add TanStack Start SDK integration (#1399) 2026-05-08 10:59:16 -07:00
app-store-entry.tsx [codex] Add TanStack Start SDK integration (#1399) 2026-05-08 10:59:16 -07:00
app-warning-modal.tsx [UI] - Updates all Icons to Phosphor Icons (#1066) 2025-12-22 10:43:45 -06:00
cmdk-commands.tsx More CMD+K actions 2026-04-06 09:12:14 -07:00
cmdk-search.tsx Replace Cmd with Ctrl on Windows computers 2026-04-17 17:04:30 -07:00
code-block.tsx Overview revamp (#1238) 2026-04-15 09:36:00 -07:00
confetti.tsx Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
copyable-text.tsx Onboarding app & restricted users (#1069) 2026-01-11 17:22:14 -08:00
country-code-select.tsx [Dashboard] Redefine the user page with tabs and updated UI (#1351) 2026-05-05 17:09:09 -05:00
dev-error-notifier.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
dialog-opener.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
editable-grid.tsx Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
editable-input.tsx Data-grid overhaul + session-replays / team-payments dashboard surfaces (#1424) 2026-05-15 14:16:47 -07:00
email-preview.tsx fix(dashboard): collapsed email editor height; sandbox email-preview iframes (#1406) 2026-05-04 15:37:33 -07:00
email-theme-selector.tsx Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
email-verification-setting.tsx Fix restricted user schema 2026-02-11 10:52:55 -08:00
entity-kpi-cards.tsx Data-grid overhaul + session-replays / team-payments dashboard surfaces (#1424) 2026-05-15 14:16:47 -07:00
env-keys.tsx [codex] Add TanStack Start SDK integration (#1399) 2026-05-08 10:59:16 -07:00
error-page.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
export-users-dialog.tsx Add server-side flags for anonymous users 2026-04-03 10:43:34 -07:00
feedback-form.tsx Update GitHub URL 2026-05-06 15:17:01 -07:00
form-dialog.tsx Update dashboard components (Except for major 4) (#1205) 2026-03-11 00:10:34 +05:30
form-fields.tsx [Fix] [Feat] Update OAuth Sign-In and Get Token Functions to Work (#1130) 2026-01-28 02:17:27 +00:00
illustrated-info.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
inline-code.tsx Onboarding app & restricted users (#1069) 2026-01-11 17:22:14 -08:00
inline-save-discard.tsx Data-grid overhaul + session-replays / team-payments dashboard surfaces (#1424) 2026-05-15 14:16:47 -07:00
link.tsx Dashboard redesign (#1029) 2025-11-28 13:21:18 -08:00
logo-upload.tsx [UI] - Updates all Icons to Phosphor Icons (#1066) 2025-12-22 10:43:45 -06:00
logo.tsx Update logo 2025-03-31 13:20:35 -07:00
metadata-editor.tsx [Dashboard] Redefine the user page with tabs and updated UI (#1351) 2026-05-05 17:09:09 -05:00
navbar.tsx Remote dev envs (#1435) 2026-05-19 15:54:18 -07:00
permission-field.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
project-card.tsx Onboarding app redesign (#1370) 2026-05-20 13:10:22 -07:00
project-switcher.tsx Remote dev envs (#1435) 2026-05-19 15:54:18 -07:00
project-transfer-confirm-view.tsx Project transfer page redesign (#1309) 2026-05-15 16:59:51 -07:00
project-users-metric.tsx Onboarding app redesign (#1370) 2026-05-20 13:10:22 -07:00
repeating-input.tsx Payments app design fixes (#1375) 2026-05-21 14:48:56 -07:00
resizable-container.tsx Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
router.tsx Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
search-bar.tsx Emails redesign (#1076) 2026-02-16 14:57:17 -08:00
settings.tsx Data-grid overhaul + session-replays / team-payments dashboard surfaces (#1424) 2026-05-15 14:16:47 -07:00
site-loading-indicator.tsx Glassy dashboard style (#411) 2025-02-03 10:03:35 -08:00
smart-form.tsx Update dashboard components (Except for major 4) (#1205) 2026-03-11 00:10:34 +05:30
smart-image.tsx Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
stack-companion.tsx AI in Stack Companion (#1297) 2026-04-13 18:40:32 +00:00
stepper.tsx stepper ui fix (#881) 2025-09-09 19:21:48 -07:00
streaming-code-viewer.tsx Overview revamp (#1238) 2026-04-15 09:36:00 -07:00
stripe-wordmark.tsx Onboarding redo (#1308) 2026-04-15 09:35:48 -07:00
style-link.tsx Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
theme-toggle.tsx Fix browser compatibility: guard requestIdleCallback and startViewTransition (#1464) 2026-05-21 14:10:51 -07:00
user-dialog.tsx Turnstile integration for fraud protection (#1239) 2026-03-20 21:26:45 +00:00
user-dialogs.tsx Payments redesign (#1045) 2025-12-17 16:34:17 -08:00
version-alerter.tsx Feature/stack companion (#769) 2025-08-12 15:12:20 -05:00