File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
npm-packages/dashboard-self-hosted/src/pages Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff 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 ( ) ,
You can’t perform that action at this time.
0 commit comments