Skip to content

Commit 011dbfc

Browse files
NicolappsConvex, Inc.
authored and
Convex, Inc.
committed
Fix dashboard-credentials-request message (#35997)
GitOrigin-RevId: 30a0543273650ea75902b9a1c653377a95204b2e
1 parent a76ff9d commit 011dbfc

File tree

1 file changed

+12
-10
lines changed
  • npm-packages/dashboard-self-hosted/src/pages

1 file changed

+12
-10
lines changed

npm-packages/dashboard-self-hosted/src/pages/_app.tsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,20 @@ function useEmbeddedDashboardCredentials(
369369
submittedDeploymentName: string;
370370
}) => void,
371371
) {
372+
// Send a message to the parent iframe to request the credentials.
373+
// This prevents race conditions where the parent iframe sends the message
374+
// before the dashboard loads.
372375
useEffect(() => {
373-
const handleMessage = (event: MessageEvent) => {
374-
// Send a message to the parent iframe to request the credentials.
375-
// This prevents race conditions where the parent iframe sends the message
376-
// before the dashboard loads.
377-
window.parent.postMessage(
378-
{
379-
type: "dashboard-credentials-request",
380-
},
381-
"*",
382-
);
376+
window.parent.postMessage(
377+
{
378+
type: "dashboard-credentials-request",
379+
},
380+
"*",
381+
);
382+
}, []);
383383

384+
useEffect(() => {
385+
const handleMessage = (event: MessageEvent) => {
384386
const credentialsSchema = z.object({
385387
type: z.literal("dashboard-credentials"),
386388
adminKey: z.string(),

0 commit comments

Comments
 (0)