-
Notifications
You must be signed in to change notification settings - Fork 26.3k
refactor(core): getting resource value throws an error instead of returning undefined #60271
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
Conversation
ada5ed0
to
2594a2c
Compare
946fdad
to
e652c69
Compare
We would like to merge it after #60272 since both of these touch error handling. |
packages/core/src/resource/api.ts
Outdated
@@ -66,7 +66,7 @@ export enum ResourceStatus { | |||
*/ | |||
export interface Resource<T> { | |||
/** | |||
* The current value of the `Resource`, or `undefined` if there is no current value. | |||
* The current value of the `Resource`, or throws an error if there is no current value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The current value of the `Resource`, or throws an error if there is no current value. | |
* The current value of the `Resource`, or throws an error if the resource is in an error state. |
packages/core/src/resource/api.ts
Outdated
@@ -186,8 +186,8 @@ export interface BaseResourceOptions<T, R> { | |||
request?: () => R; | |||
|
|||
/** | |||
* The value which will be returned from the resource when a server value is unavailable, such as | |||
* when the resource is still loading, or in an error state. | |||
* The value which will be returned from the resource when a server value is unavailable and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* The value which will be returned from the resource when a server value is unavailable and | |
* The value which will be returned from the resource when a server value is unavailable, such as | |
* when the resource is still loading. |
e652c69
to
c186fde
Compare
…efined When there is an underlying error state it would not be possible to swallow the error with: `computed(() => res.value()?.inner);`
c186fde
to
3102ba7
Compare
Close in favour of #60610 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When there is an underlying error state it would not be possible to swallow the error with: