Skip to content

Refactor code structure #1350

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

Merged
merged 6 commits into from
Aug 19, 2021
Merged

Refactor code structure #1350

merged 6 commits into from
Aug 19, 2021

Conversation

shuding
Copy link
Member

@shuding shuding commented Aug 18, 2021

  • Organize revalidation callbacks into RevalidateCallback and StateUpdateCallback. The revalidate callback receives internal event (onfocus, onreconnect, onmutate) that might trigger a revalidation to the hook. The state update callback handles hooks' setState events. This is the initial step for some future features.
  • The new subscribe-key util makes the core leaner.
  • Other tweaks.

@shuding shuding requested a review from huozhi as a code owner August 18, 2021 22:21
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 18, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 47874fd:

Sandbox Source
SWR-Basic Configuration
SWR-States Configuration
SWR-Infinite Configuration
SWR-SSR Configuration

Copy link
Member

@huozhi huozhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, left 2 small comments. great job!

const boundMutate: SWRResponse<Data, Error>['mutate'] = useCallback(
(newData, shouldRevalidate) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix lint

Copy link
Collaborator

@promer94 promer94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw those changes on trigger branch few days ago, lgtm 👍

@shuding shuding merged commit aa28fb7 into master Aug 19, 2021
@shuding shuding deleted the refactor-revalidator branch August 19, 2021 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants