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

141
Visualizações
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
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