-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: pha with data loader #6029
Conversation
const [appConfig, routesConfig, dataloaderConfig] = await Promise.all([getAppConfig(['phaManifest']), getRoutesConfig(), getDataloaderConfig()]); | ||
const [appConfig, routesConfig] = await Promise.all([getAppConfig(['phaManifest']), getRoutesConfig()]); | ||
|
||
let dataloaderConfig; |
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.
如果被 catch 了,这个 dataloaderConfig 是一个 undefined,下面处理是否有兜底逻辑,默认给个控对象?
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.
应该是后续消费的地方,本身做了兼容的,效果等同于没有配 DataLoader
CI 报错啦 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## release/next #6029 +/- ##
================================================
- Coverage 82.07% 82.05% -0.03%
================================================
Files 197 197
Lines 18090 18132 +42
Branches 2361 2367 +6
================================================
+ Hits 14848 14878 +30
- Misses 3207 3219 +12
Partials 35 35
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
// dataLoader may have side effect code. | ||
dataloaderConfig = await getDataloaderConfig(); | ||
} catch (err) { | ||
logger.debug('PHA: getDataloaderConfig failed.'); |
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.
logger.debug 是手动打开某个参数才会提示吗?不会透露给用户?
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.
建议是用 namespace,不要 PHA:
packages/ice/src/utils/logger.ts
Outdated
@@ -53,6 +53,9 @@ export type CreateLoggerReturnType = Pick<Consola, | | |||
'debug' | | |||
'trace' | |||
>; | |||
|
|||
export type CreateLogger = (namespace?: ICELogNamespace) => CreateLoggerReturnType; | |||
|
|||
export function createLogger(namespace?: ICELogNamespace): CreateLoggerReturnType { |
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.
如果是上面定义了 CreateLogger 的话,这里建议写成函数表达式
// dataLoader may have side effect code. | ||
dataloaderConfig = await getDataloaderConfig(); | ||
} catch (err) { | ||
logger.debug('PHA: getDataloaderConfig failed.'); |
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.
建议是用 namespace,不要 PHA:
如果 data loader 存在立即执行代码,增加保护措施,避免报错引起 Manifest 构建失败