Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty selector pulls deleted entries on fresh db #8

Open
veber-alex opened this issue Jun 30, 2017 · 0 comments
Open

empty selector pulls deleted entries on fresh db #8

veber-alex opened this issue Jun 30, 2017 · 0 comments

Comments

@veber-alex
Copy link

Hi,
I took the example from the front page and ran in as a test, after adding some todo entries I checked that everything synced to CouchDB and it looked fine.
After that I deleted all the entries and deleted the local PouchDB in the browser and refreshed the page.
It looks like the first load when the local DB doesn't exist somehow pulls also all the deleted entries from CouchDB, I see a lot of blank objects, doing another refresh resolves the issue.
Here is the code I used:

<template>
  <div>
    <input v-model="message" placeholder="New Todo">
    <button @click="$pouch.post('todos', {message: message});message=''">Save Todo</button>
    <div v-for="todo in todos">
      <input v-model="todo.message" @change="$pouch.put('todos', todo)">
      <button @click="$pouch.remove('todos', todo)">Remove</button>
    </div>
  </div>
</template>

<script>
  export default {
    data(){
      return {
        message: ''
      }
    },
    name: 'todo',
    // VuePouch adds a `pouch` config option to all components.
    pouch: {
      // The simplest usage. queries all documents from the "todos" pouch database and assigns them to the "todos" vue property.
      todos: {/*empty selector*/}
    },
    created: function () {
      // Send all documents to the remote database, and stream changes in real-time
      this.$pouch.sync('todos', 'http://localhost:5984/todos');
    }
  }
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant