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

Composite primary keys and null values #748

Open
Tofandel opened this issue Jul 22, 2021 · 0 comments
Open

Composite primary keys and null values #748

Tofandel opened this issue Jul 22, 2021 · 0 comments

Comments

@Tofandel
Copy link

Describe the bug

When inserting models with composite primary keys, if one of the keys is null, it's inserted with "$uid123" instead of the null value

Steps to reproduce the bug

  1. Create a model with a composite primary key, one of which is nullable
  2. Insert a model with a null primary key
  3. Notice how it's been inserted at ["1","$uid1"]

Expected behaviour

The models to be inserted with the $id containing null values and not $uid1

Like this: ["1",null]

Versions

  • Vuex ORM: 0.36.4
  • Vue: 2.6.14

Link to minimal reproduction

https://codesandbox.io/s/vuex-orm-crud-sample-forked-qyc8u?file=/src/post.js

Additional context

I tried using a mutator setting null, while it fixes the retrieving, it doesn't solve the insertion
I also tried using user_id: this.uid(() => null), but it causes a different issue where the created $id is null (ignoring the fact that it's a composite key) if the value of that key is null

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