chore: simpler fallback values #12788
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Was reminded of this by #12781. We currently make things very complicated when rewriting destructuring patterns that have default values — this...
...becomes this...
As of #12780 it becomes this instead, which is simpler...
...but really it should just be this:
This PR makes a few changes:
value_or_fallback
to justfallback
, and moves it to theshared
directory since it's currently duplicated between server and clientvalue_or_fallback_async
, which doesn't do anythingbuild_fallback
function instead of duplicating logic between the various places that need to create$.fallback
code[answer = 42]
, we don't need to wrap the42
in a thunkawait
expressions — we don't need to wrap the fallback value in an async thunk it it's just something likeawait promise
, we can just await the whole expressionBefore submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests and linting
pnpm test
and lint the project withpnpm lint