Skip to content

upgrade to 0.34 broke queries with no results #504

@2-5

Description

@2-5

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingreleasedThe issue was implemented and it is released publicly

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions