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

upgrade to 0.34 broke queries with no results #504

Closed
2-5 opened this issue Nov 25, 2019 · 2 comments
Closed

upgrade to 0.34 broke queries with no results #504

2-5 opened this issue Nov 25, 2019 · 2 comments
Assignees
Labels
bug Something isn't working released The issue was implemented and it is released publicly

Comments

@2-5
Copy link

2-5 commented Nov 25, 2019

This code worked in 0.33, but fails in 0.34, because first() returns undefined instead of null when the query has no results:

const setting: Setting | null = Setting.query()
  .where('name', name)
  .first()

if (setting === null) {
  return defaultValue
}

// TypeError: Cannot read property 'value' of undefined
const value: string = setting.value
@kiaking
Copy link
Member

kiaking commented Nov 26, 2019

Thank you for the report! Confirmed. Fix is on the way.

@kiaking kiaking added bug Something isn't working in progress The implementation is in progress labels Nov 26, 2019
@kiaking kiaking self-assigned this Nov 26, 2019
kiaking added a commit that referenced this issue Nov 26, 2019
…defined

#504 Fix first and last method returning undefined on empty result
@kiaking kiaking added resolved Issue have been resolved but not yet released and removed in progress The implementation is in progress labels Nov 26, 2019
@kiaking
Copy link
Member

kiaking commented Nov 26, 2019

This is now fixed at Vuex ORM 0.34.1! Thank you for reporting it!
https://github.com/vuex-orm/vuex-orm/releases/tag/v0.34.1

@kiaking kiaking closed this as completed Nov 26, 2019
@kiaking kiaking added released The issue was implemented and it is released publicly and removed resolved Issue have been resolved but not yet released labels Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released The issue was implemented and it is released publicly
Projects
None yet
Development

No branches or pull requests

2 participants