Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!