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

Flush does not work #12

Closed
tintin10q opened this issue Apr 28, 2022 · 8 comments
Closed

Flush does not work #12

tintin10q opened this issue Apr 28, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@tintin10q
Copy link
Sponsor Contributor

tintin10q commented Apr 28, 2022

Flush does not work. It could be because this model has a list as a primary key?

import { Model } from "pinia-orm";

export default class HumanSavedShow extends Model {
  static entity = "HumanSavedShow";
  static primaryKey = ["human_id", "show_id"];

  static fields() {
    return {
      human_id: this.uid(),
      show_id: this.uid(),
      added_at: this.number(0)
    };
  }
}
<template>
  <button @click="testFlush">Flush does not work</click>
</template>


<script setup lang="ts">
import { useRepo } from "pinia-orm";
import HumanSavedShow from "@/models/HumanSavedShow";

const SAVEDSHOWS = useRepo(Spotify_HumanSavedShow)

function testFlush() {
  console.log('There are ', SAVEDSHOWS.all().length, 'Shows');
  useRepo(Spotify_HumanSavedShow).flush();
  SAVEDSHOWS.flush();
  console.log('There are ', SAVEDSHOWS.all().length, 'Shows');
  SAVEDSHOWS.new()
  console.log('There are ', SAVEDSHOWS.all().length, 'Shows');
}
</script>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "App",
});
</script>

I would expect flush to delete all the records stored. https://next.vuex-orm.org/guide/repository/deleting-data.html#deleting-data

But it doesn't delete anything.

@tintin10q
Copy link
Sponsor Contributor Author

Right now it is impossible for me to delete these HumanSavedShow.

@CodeDredd CodeDredd added the bug Something isn't working label May 7, 2022
@CodeDredd
Copy link
Owner

@tintin10q thx for reporting. if i find time i am fixing it 😉.... the problem with flush is, that i dont use connection anymore the way it was used.

@tintin10q
Copy link
Sponsor Contributor Author

I have no idea what that means but thank you! Looking forward to the fix.

@tintin10q
Copy link
Sponsor Contributor Author

Could you give an update on this? It has been 2 months. When do you think you will have time to fix this?

@tintin10q
Copy link
Sponsor Contributor Author

@CodeDredd Maybe with sponsoring you will find it easier to find some time 😉

@CodeDredd
Copy link
Owner

@tintin10q Many thanks for the sponsering. Means a lot to me that you are my first sponsor! Will fix it soon now for you ❤️

Sorry for keeping you waiting that long. Having family & work sometimes leave me less time for open source work.

@CodeDredd
Copy link
Owner

It gets me thinking....maybe i should oftner wait until i fix something so i get more sponsoring 🤣 ... just kidding....maybe

@CodeDredd
Copy link
Owner

i am still on it....had just too much work past days. Just as information.

CodeDredd added a commit that referenced this issue Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants