Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
is it possible to monitor dispath complete in react

I am writing a react front end app now, today I facing a dispatch problem. I write a edit page to edit some data, after the edit complete, I dispatch an action to send a http request to flush new data into server side database, this is the code look like:

if (!data.id) {
        obj = {
          type: 'punishM/addPunish',
          payload: params,
        };
      } else {
        obj = {
          type: 'punishM/editPunish',
          payload: {
            id: data.id,
            ...params,
          },
        };
      }

      dispatch({
        ...obj,
      });

after send the http request, the next step I need to refresh the UI table data to show the newest data collection by send another http request. But now the problem is that when I send the new http request to fetch data, the fetched sometimes the legacy data collection. So I need to know the first dispatch was complete, then I send the new dispatch to fetch the new data, but I did not know how to do it like this, I did not know how to listening the fisrt dispatch complete. is it possible to know the first dispath complete? or any better way to implement this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda