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

134
Views
When to decide between fetching data from API or use the client cache if push events don't exist?

Imagine you had a simple todo app using Vue and Vuex with a backend (external API, localstorage, ...).

Inside the store you hold all the todos and manage them. But when should you synchronize your store with the backend? Always? If yes, then Vuex is redundant and you can directly call the backend.

Many tutorials out there show examples like

function getTodos() {
  const store = getStoreInstance();
  
  if(!store.todos) {
    store.todos = fetchTodosFromBackend();
  }

  return store.todos;
}

but by doing so the store would synchronize with the backend only once. Imagine the backend provides no push events and you can only ask for data or send write requests.

What are the best practices to keep the todos (which might be manuplated by other clients) in sync with the store?

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!