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

276
Visualizações
NgRx - multiple dispatching causes the browser to stop responding. How to update multiple elements each second withouth performance issues?

in my applications i'm using Pixi.js for drawing a map with multiple elements. Each second the positions of these elements is updated, the problem is that every time position is updated the elemenet is created from scratch (component is destroyed) but I need to have a previous value of position to make some calculations. So I wanted to add such a state to the store but to have them there I need to dispatch them. So for example 30 elements are created at the same time every second, and at the same time all of them are dispatched. It's breaking the application. Do you have any advice on how to store this data differently so as not to cause performance problems?

This is my reducer method:

function updateRotation(state: State, callSing: string, rotation: number): State {
  const newState = cloneDeep(state);
  if (!newState.elementRotation) {
    newState.elementRotation= {};
  }
  newState.elementRotation[callSing] = rotation;
  return newState;
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If your item is big, that cloneDeep might slow down your performance. You don't need it.

function updateRotation(state: State, callSing: string, rotation: number): State {
  return {
    ...state,
    rotation: {
      ...state.rotation,
      [callSing]: rotation
    }
  }
}
about 4 years ago · Juan Pablo Isaza Relatório
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