Skip to content
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(usestore): use selector to replace depActions #161

Merged
merged 3 commits into from
May 19, 2020
Merged

Conversation

ArrayZoneYour
Copy link
Contributor

@ArrayZoneYour ArrayZoneYour commented May 19, 2020

re #46

@codecov
Copy link

codecov bot commented May 19, 2020

Codecov Report

Merging #161 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #161   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          296       317   +21     
  Branches        70        80   +10     
=========================================
+ Hits           296       317   +21     
Impacted Files Coverage Δ
src/helper.ts 100.00% <100.00%> (ø)
src/index.tsx 100.00% <100.00%> (ø)
src/middlewares.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c071c2...5e195de. Read the comment docs.

Copy link
Contributor

@leecade leecade left a comment

Choose a reason for hiding this comment

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

done

}
}
}

type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y
Copy link
Contributor

Choose a reason for hiding this comment

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

can we improve here?

? [Get<M[K], 'state'>, getConsumerActionsType<Get<M[K], 'actions'>>]
? S extends (...args: any) => void
? [
Equals<ReturnType<S>, unknown> extends true
Copy link
Contributor

Choose a reason for hiding this comment

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

unknown => any, see: :157

) {
setter.selectorRef = setter.selector(Global.State[modelName])
Copy link
Contributor

Choose a reason for hiding this comment

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

React will check state as shadowEq, double check here is heavy.

@leecade leecade merged commit c9d04ef into master May 19, 2020
@ArrayZoneYour ArrayZoneYour deleted the feat/selector branch June 8, 2020 10:50
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