-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: fallback useRouteMeta logic and handle errors caused by custom routeMeta #2137
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
PeachScript
reviewed
Jun 5, 2024
} | ||
return meta; | ||
}; | ||
const meta = merge(getRouteMetaById(route.id, { syncOnly: true })); | ||
const proxyGetter = (target: any, prop: string) => { | ||
if (ASYNC_META_PROPS.includes(prop)) { | ||
if (!asyncCache.get(cacheKey)) { |
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.
这里不太对,原有逻辑有 2 条路径:
- 不存在 cache 时,创建 cache 并 throw
- 存在 cache 时直接 throw
新逻辑只有 1 条路径:
- 不存在 cache 且存在异步资源时,创建 cache 并 throw
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.
捋了下应该要做两个调整,供参考:
- getRouteMetaById 要继续放进 cache 是否存在的 if 里面,否则会多调用函数
- throw 要挪回原位置,但判定一下 cache 存在时才 throw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤔 这个变动的性质是?/ What is the nature of this change?
🔗 相关 Issue / Related Issue
💡 需求背景和解决方案 / Background or solution
#2134 引入问题
📝 更新日志 / Changelog