Closed HADB closed 3 months ago
Hello HADB, Thank you for your first issue contribution 🎉
拉代码本地跑了下,看了下日志发现 queryText 传进去了,但似乎后来 cancel 了,我研究下。
15:10:41.326 configDefaultAxios
15:10:41.326 enter audio.ts
15:10:41.326 audio path: /Users/bean/Library/Application Support/com.raycast.macos/extensions/easydict/audio
15:10:41.326 enter youdao.ts
15:10:41.326 start getYoudaoWebCookie
15:10:41.326 enter volcanoAPI.ts
15:10:41.327 enter bing.ts
15:10:41.327 enter google.ts
15:10:41.327 enter dataManager.ts
15:10:41.327 enter easydict.tsx
15:10:41.350 ---> arguments queryText: hello,world
15:10:41.350 update input text: hello,world, length: 11
15:10:41.351 cancel, and remove all query list
15:10:41.354 ---> delay query text: hello,world, isDelay: false
15:10:41.378 ---> arguments queryText: hello,world
15:10:41.378 update input text: hello,world, length: 11
15:10:41.388 cancel, and remove all query list
15:10:41.388 ---> delay query text: hello,world, isDelay: false
15:10:41.416 The List view is changing an uncontrolled search bar to be controlled. This is likely caused by the `searchText` changing from `undefined` to a defined value, which should not happen. Decide between using a controlled or uncontrolled search bar element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components
15:10:41.416 start queryText: hello,world
15:10:41.417 resetProperties
15:10:41.417 start detectLanguage
15:10:41.417 api detect queryText: hello,world
15:10:41.418 detect lowerCaseText: hello,world
15:10:41.418 start raceDetectLanguage
15:10:41.418 start bingDetect
15:10:41.418 start requestWebBingTranslate
15:10:41.418 no stored bingConfig, get a new one
15:10:41.418 start requestBingConfig
15:10:41.419 check if ip in China
15:10:41.435 update input text: , length: 0
15:10:41.436 trimText is empty, do not query
15:10:41.437 cancel, and remove all query list
15:10:41.437 getCurrentIp error: CanceledError: canceled
15:10:41.437 checkIfIpInChina error: CanceledError: canceled
15:10:41.438 get bing tld: cn
15:10:41.440 config bingTld: cn
15:10:41.441 get bing config url: https://cn.bing.com/translator
15:10:41.441 requestBingConfig error: CanceledError: canceled
15:10:41.441 get bingConfig failed
15:10:41.441 ---> bing detect error: {"type":"Bing Translate","message":"Get bing config failed"}
15:10:41.441 race detect language error: {
"type": "Bing Detect",
"message": "Get bing config failed"
}
15:10:41.441 last detect action fail, return undefine
15:10:41.441 start try get final detect: undefined
15:10:41.441 handleFinalDetectedLangFromAPIList
15:10:41.442 no detected language, return undefined
15:10:41.442 start local detect language, confirmed confidence (>0.8)
15:10:41.442 start franc detect: hello,world
15:10:41.442 franc detect cost time: 2 ms
15:10:41.442 franc detected language array: [
[ 'nl', 1 ],
[ 'da', 0.7734056987788331 ],
[ 'fi', 0.5780189959294437 ],
[ 'pl', 0.5671641791044777 ],
[ 'tr', 0.39891451831750335 ],
[ 'sv', 0.3772048846675712 ],
[ 'it', 0.37177747625508817 ],
[ 'en', 0.32157394843962006 ],
[ 'hr', 0.29172320217096337 ],
[ 'hu', 0.28358208955223885 ],
[ 'fr', 0.19402985074626866 ],
[ 'sr-Latn', 0.1872455902306649 ],
[ 'de', 0.07734056987788329 ],
[ 'es', 0.042062415196743586 ],
[ 'pt', 0 ],
[ 'id', 0 ],
[ 'vi', 0 ],
[ 'ro', 0 ],
[ 'tl', 0 ],
[ 'cs', 0 ],
[ 'sk', 0 ],
[ 'lt', 0 ],
[ 'sl', 0 ]
]
15:10:41.442 franc detect preferred but unconfirmed language: en, confidence: 0.32157394843962006 (>0.2)
15:10:41.442 ---> final confirmed: false, type: Franc Detect, detectLanguage: en
15:10:41.442 ---> query has been canceled, stop, return
15:10:41.712 get web youdaoCookie: OUTFOX_SEARCH_USER_ID=-39917529@121.46.247.133; domain=.youdao.com; expires=Fri, 17-Jul-2054 07:10:41 GMT
15:10:41.712 get youdaoCookie cost time: 395 ms
打日志看了下,看起来是 List
组件触发了一个 onSearchTextChange
的事件,然后在这个事件的处理方法 onInputChange
中 text
给置为空了,但我没开发过 Raycast
的插件,对这个地方不太了解,大佬之前遇到过这个问题吗?
@tisfeng Hi,大佬,我提交了一个 PR #63 ,修复了这个问题。
奇怪,我本地测试没有遇到 Arguments 参数丢失问题。。。
我对 React 不熟,不知道到底什么问题 😓
我跑了一下你的 PR 代码,似乎也没有问题,行吧,那我就先合并它。
遇到了同样的问题,修复代码已经在最新版本中发布了吗?已经更新到最新版本了,这个问题还是有的。 Raycast 1.81.1 macOS 12.7.6
Raycast 商店版还没有更新,当前仓库最新的代码应该已经修复了,在我电脑上跑没问题,你可以自己测试看看。
商店版本已发布更新 raycast/extensions#14179
现在没有问题了,👍
@HADB @tisfeng #63 这个fix会导致任何情况下的第一次输入被忽略,比如从剪贴板粘贴内容,比如用中文输入法一次性输入短语
不太明白你的描述,你能详细解释一下吗,或者提交一个 PR ?
https://github.com/user-attachments/assets/e09e86ee-022c-4358-99bd-b71d3f5c3601
@tisfeng 第一次是一次性输入中文,因为只有一个onSearchTextChange事件,被略过了。第二次是从剪贴板粘贴,同样是只有一次事件。
明白了,这里确实有问题。
关于如何修复,你有什么想法?可以 PR 吗 🥺
Please confirm the following:
Problem description
直接在 command 页面翻译没问题,但是在首屏通过 Arguments 参数搜索进入 command 页面的时候,搜索的参数丢失了
Is the issue consistently reproducible?
Reproducible
Steps to Reproduce
Tab
键,进入 Query 框输入hello
,按回车键Screenshot
Expected result
正常带入 Arguments 参数搜索
Proposed solution (optional)
No response
Are you willing to submit a PR to fix this issue?