-
Notifications
You must be signed in to change notification settings - Fork 67
feat: add rating in card #372
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
Open
xxfttkx
wants to merge
6
commits into
ZOOT-Plus:dev
Choose a base branch
from
xxfttkx:dev
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d65579a
add rating in card
xxfttkx d6e997c
remove unnecessary useEffect
xxfttkx 5d436e8
Merge branch 'MaaAssistantArknights:dev' into dev
xxfttkx a8f019d
fix mutate key
xxfttkx 3b4d074
Merge branch 'dev' of https://github.com/xxfttkx/maa-copilot-frontend…
xxfttkx 2a360ef
remove useOperation
xxfttkx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
for mutex of http requests.
@guansss , previously, multple like and dislike post operations were sent to the server.
In other words, I would doubt the validity of the data if they were sent from the browser.
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.
@martinwang2002 mutate() 的 key 不是用来做 mutex 的吧,是用来与 useSWR() 里同样的 key 对应起来,以更新缓存并触发 revalidate
短时间发送多个请求是没问题的,反正最后都会 revalidate,以服务器返回的数据为准
Uh oh!
There was an error while loading. Please reload this page.
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.
我试了一下,这请求确实太多了点……
edit: 原因是这个 mutate() 的第一个参数是 key,这里传了个发请求的函数进去作为 key,所以实际上是整个页面里有多少个 useSWR() 就发了多少个 rating 请求,并且刷新了所有的 useSWR()……
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.
一个函数作为key传入后,被当成了filter,这就导致了“整个页面里有多少个 useSWR() 就发了多少个 rating 请求”。
ref: https://swr.vercel.app/docs/mutation#parameters