-
Notifications
You must be signed in to change notification settings - Fork 307
处理popup问题 #1100
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
处理popup问题 #1100
Conversation
|
還沒看 不然改完一次又要重新改 (我指popup資料保存/殘留的部份) |
|
所以問題是react沒正確繪畫,還是pageload那個儲存更新的問題呀? |
| public getRecord(keys: string[]): Promise<Partial<Record<string, T>>> { | ||
| keys = keys.map((key) => this.joinKey(key)); | ||
| if (this.useCache) { | ||
| return loadCache().then((cache) => { | ||
| const record: Partial<Record<string, T>> = {}; | ||
| for (const key of keys) { | ||
| if (cache[key]) { | ||
| record[key] = Object.assign({}, cache[key]); | ||
| } else { | ||
| record[key] = cache[key]; | ||
| } | ||
| } | ||
| return record; | ||
| }); | ||
| } | ||
| return new Promise((resolve) => { | ||
| chrome.storage.local.get(keys, (result) => { | ||
| const lastError = chrome.runtime.lastError; | ||
| if (lastError) { | ||
| console.error("chrome.runtime.lastError in chrome.storage.local.get:", lastError); | ||
| // 无视storage API错误,继续执行 | ||
| } | ||
| resolve(result as Partial<Record<string, T>>); | ||
| }); | ||
| }); | ||
| } | ||
|
|
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.
改了写法后没用了,不过觉得以后还是需要这种操作,就留下来了
我记得是 vivaldi 或是什么浏览器,你打开了 popup 后,关掉再开还是同一个画面 所以关了popup 切换语言 后,React没乱跑重绘的话,显示不会切换到新语言 |

概述 Descriptions
修改了normalScriptCounts、backScriptCounts计数逻辑,不需要去分两个memo ,修复总数至少会为1的问题
删除了 scriptDataAsyncCounter,在useEffect中可以判断
删除了 extraData.lang , 在 popup 页面打开的情况下,不可能切换语言 (暂时未动)
这个 extraData 的逻辑。。。。真的绕,打开popup的script会更新的情况应该是很少数,为了很少数的情况做这个处理也是一种性能浪费,而且存在bug,暂时没排查出来不过大概是这一块的原因,
今天先没时间了,想改成其它的逻辑了,还是改了,睡觉先有时候列表显示全是空,但是实际上是有数据的 (2/6) (1/1):
变更内容 Changes
截图 Screenshots