You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes the versioning error that we ran into for custom
dashboards. Now if the latest version of the packages does not work, we
fall back to the version that is one patch below the latest version. We
log this into sentry. If the fall back doesn't work either, we log that
into sentry as well and show the user an error message.
Apart from that, I also made changes to ensure dashboards with older
versions of the dashboard-ui-component package would still work. Each
dashboard now stores the version it was created with, as a comment at
the top of its source code, and we use that version when loading the
dashboard. When a dashboard gets edited via the AI chat, we re-stamp it
with the latest version of the package so it stays up to date.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved error handling and reporting for dashboard load failures;
host surfaces structured dependency errors for faster diagnostics.
* Added automatic fallback loading for missing resources to reduce load
failures.
* Fixed page height calculation so pages align correctly with the
viewport.
* **New Features**
* Generated and editor-provided dashboard code is now stamped with the
app version for clearer provenance.
* **UI/UX Improvements**
* Clearer, more informative error messages when custom dashboard loading
encounters issues.
[](https://app.coderabbit.ai/change-stack/hexclave/stack-auth/pull/1418)
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
window.parent.postMessage({type: 'dashboard-error-boundary',message: '[sandbox] Stack SDK fallback also failed: '+e2?.message},'*');
95
+
failDependencyLoad('[sandbox] @stackframe/js fallback failed at version ${esmFallbackVersion}: '+formatDependencyError(e2),e2);
52
96
}
53
97
}
54
98
window.generateUuid=()=>crypto.randomUUID();
@@ -61,17 +105,39 @@ function getDependencyScripts(esmVersion: string, esmFallbackVersion: string, da
61
105
window.dispatchEvent(newEvent('deps-ready'));
62
106
};
63
107
script.onerror=(e)=>{
64
-
window.parent.postMessage({
65
-
type: 'dashboard-error-boundary',
66
-
message: 'Failed to load dashboard-ui-components IIFE bundle',
67
-
},'*');
108
+
constmessage='[sandbox] Failed to load local dashboard-ui-components IIFE bundle. Run pnpm --filter @stackframe/dashboard-ui-components dev or pnpm --filter @stackframe/dashboard-ui-components build so apps/dashboard/public/dashboard-ui-components.iife.js exists.';
109
+
failDependencyLoad(message,einstanceofError ? e : newError(message));
68
110
};
69
111
document.head.appendChild(script);
70
112
</script>`;
71
113
}
72
114
73
115
returnhtml`
74
116
<scripttype="module">
117
+
constCUSTOM_DASHBOARD_LOAD_ERROR_MESSAGE='There was a problem loading custom dashboards. Please refresh the page and try again.';
window.parent.postMessage({type: 'dashboard-error-boundary',message: '[sandbox] Failed to load at version ${esmVersion}, trying fallback ${esmFallbackVersion}: '+e?.message},'*');
0 commit comments