-
Notifications
You must be signed in to change notification settings - Fork 37
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
Fix issue with keepLatest and empty values #1051
Fix issue with keepLatest and empty values #1051
Conversation
Run & review this pull request in StackBlitz Codeflow. |
|
49cc689
to
d332449
Compare
Copied over from: NullVoxPopuli/ember-resources#1051 Co-Authored-By: Peter Wagenet <[email protected]>
* Fix issue with initial values in `keepLatest` and clarify behavior Copied over from: NullVoxPopuli/ember-resources#1051 Co-Authored-By: Peter Wagenet <[email protected]> * Update jsTest * lint:fix --------- Co-authored-by: Peter Wagenet <[email protected]>
tl;dr:
value
on the first run of thekeepLatest
, if available (instead of previous, which is alwaysundefined
)The way to provide a default value when the value of keepLatest is false is to use another getter.
This PR adds a couple tests clarifying that behavior:
It's important to not do
because that means falsey responses (on
data
), will resolve to{}
, and cause content flashes.So to keep the latest value, you want to let the
data
response be what it actually is.In traditional logic, this could maybe be expressed this way:
when default is always truthy
vs