-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
feat(solid): add solid statesHook #479
base: main
Are you sure you want to change the base?
Conversation
|
感谢 PR!目前发现了以下问题:
稍后记得补充 changeset 😃 |
@@ -22,7 +22,7 @@ | |||
"importHelpers": true, | |||
"removeComments": false, | |||
"esModuleInterop": true, | |||
"jsx": "react", | |||
"jsx": "react-jsx", |
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.
这里修改的原因是什么?
如有需要,请在 client 下的 tsconfig 中修改,以免影响其他模块。
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.
请不要提交无意义更改
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.
综合所述,可能还有些需要修改之处,本来想直接给修改的,但这么久跟下来solid单测集成进来确实存在一些困难,你也可以尝试修改,或者我后面再抽空修改下
import { getStateCache } from '@/hooks/core/implements/stateCache'; | ||
import { useRequest } from '@/index'; | ||
import { key } from '@alova/shared/function'; | ||
import { fireEvent, screen, waitFor } from '@testing-library/dom'; |
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.
这里应该要用@solid/testing-library,https://github.com/solidjs/solid-testing-library
}, | ||
|
||
onMounted: callback => { | ||
createEffect(callback); |
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.
createEffect可能会带副作用,即callback内如果有solid状态的话,当状态改变时此callback依然会执行,因此这不是一个纯粹的onMounted钩子
|
||
render(() => (<Page />) as unknown as JSX.Element); | ||
|
||
waitFor(() => { |
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.
没有添加await
时检测不到回调内部的期望值,当添加上await
时此单测是报错的,下同
相关 Issue / Related Issue
[Issue ID]
这个 PR 是什么类型?/ What type of PR is this?
这个 PR 做了什么?/ What does this PR do?
[简要描述所做更改 / Describe the changes briefly]
文档 / Docs
[此次 PR 的文档 / Docs for this PR]
测试 / Testing
[描述测试结果 / Describe the test results.]