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

249
Visualizações
Get error: warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application

I have code something like this:

componentDidMount() {
    const { account, columns } = this.state;

    getDependencies(this.context.contextPath, account, columns ).then(response => {
      const updated = response.columns;
      const newDimensions = updated.filter(
        ({ dimensionId: id1 }) =>
          !columns.some(
            ({ dimensionId: id2 }) =>
              id2 === id1
          )
      );

      let temp = columns.concat(newDimensions);
      temp = _.sortBy(temp, ['orderNo']);

      this.setState(
        {
          allowedPostingDimensions: response.allowedDimensions,
          columns: temp,
          account: response.glAccount,
          isDependenciesLoaded: true,
        }, this.handleItemChange
      );
    });
  }

And after sorting the columns I get error and setting I get this error:

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

If I don't sort columns (just add new columns) I will not get this errors.

I already have tried to create flag in state: isMounted: false. In componentDidMount set state isMounted = true and in componentWillUnmount: set state isMounted = false. This is not help to me.

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