Skip to content

Commit 3ad3252

Browse files
committed
Fix falsy attribute values not being returned
1 parent 536b050 commit 3ad3252

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Fix falsy attribute values not being returned
13+
1014
## [0.2.0-beta.4] - 2024-10-01
1115

1216
### Changed

src/store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ export class Store<Schemas extends SchemaCollection = {}> {
9696
return new Proxy(new ModelClass(data), {
9797
get: (target, prop, receiver) => {
9898
if (typeof prop === 'string') {
99-
if (target.attributes?.[prop]) {
99+
if (target.attributes?.[prop] !== undefined) {
100100
return target.attributes[prop];
101101
}
102102
const data = target.relationships?.[prop]?.data;
103-
if (data) {
103+
if (data !== undefined) {
104104
return Array.isArray(data)
105105
? this.find(data)
106106
: this.find(data);

0 commit comments

Comments
 (0)