Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
Parent SPFx React hooks web part open and close children's windows. the child close hangs the parent

I have 2 applications that need to work together. the parent has a list of jobs and the user may open them in the second (child) application as many jobs as he wants. The code to open a child is:

 window.open(finalUrl, 'W' + event.data.ProjJob, "alwaysRaised=yes,titlebar=no,left=0,top=0,width=800,height=800");
    if (!inboxPopUpJobs.some(j => j.job === event.data.ProjJob)) {
      setInboxPopUpJobs(PopUpJobs => [...PopUpJobs, event.data.ProjJob]);
    }

When the child windows needs to refresh the parent and close, it sends a message using the 'broadcast-channel' library

The message is received OK by the parent with the job number so the window is intercepted by using:

 const w = window.open("", 'W' + job);

then to close it I use:

await w.close();

but now the parent window hangs, there is nothing showing in the console as error and there is no way to even refresh the browser (EDGE and Chrome) I tried: w.opener.focus(); and window.focus(); but it is still hanging.

Does any one have a suggestion how to prevent the parent from hanging? Thank you

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda