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: Merged state and user can change merged state. #224

Merged
merged 2 commits into from
May 19, 2023

Conversation

yanguoyu
Copy link
Contributor

  1. Extract merge strategy to merge-strategy, and create DefaultMergeStrategy and UseLatestStrategy .
  2. And now mergeState has calculated when handleCell, and developers can change mergeState by set.

packages/models/src/exceptions/store.ts Outdated Show resolved Hide resolved
packages/models/src/exceptions/store.ts Outdated Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Outdated Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Outdated Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Outdated Show resolved Hide resolved
merge(object: S, source?: S): S {
if (source === undefined || source === null) return object
if (Array.isArray(object)) return object.concat(source) as S
return this.defaultMergeWith(source, object)
Copy link
Member

Choose a reason for hiding this comment

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

The order of destination and source is reversed from that of definition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should use the new value in object to cover the old value in source, so we need set object as the second parameter.

Copy link
Member

Choose a reason for hiding this comment

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

If we can switch the parameters of private defaultMergeWith so they won't be mixed in all cases.

Copy link
Member

Choose a reason for hiding this comment

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

Let's do it later because defaultMergeWith is private

packages/models/src/store/merge-strategy.ts Outdated Show resolved Hide resolved
packages/models/src/store/merge-strategy.ts Show resolved Hide resolved
@Keith-CY
Copy link
Member

Keith-CY commented May 5, 2023

Please have a review @zhengjianhui @Daryl-L @PainterPuppets

@Keith-CY
Copy link
Member

Please have a review @zhengjianhui @Daryl-L @PainterPuppets

@Keith-CY
Copy link
Member

Please resolve the conflicts

@yanguoyu
Copy link
Contributor Author

I'm adding test cases for merge-strategy.

@codecov-commenter
Copy link

Codecov Report

Merging #224 (2be2274) into develop (ff2ab84) will increase coverage by 1.56%.
The diff coverage is 88.84%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #224      +/-   ##
===========================================
+ Coverage    68.56%   70.12%   +1.56%     
===========================================
  Files           84       85       +1     
  Lines         2306     2490     +184     
  Branches       515      555      +40     
===========================================
+ Hits          1581     1746     +165     
- Misses         658      675      +17     
- Partials        67       69       +2     
Impacted Files Coverage Δ
packages/models/src/exceptions/store.ts 61.90% <55.55%> (-1.74%) ⬇️
packages/models/src/store/store.ts 88.26% <88.14%> (+0.42%) ⬆️
packages/models/src/store/merge-strategy.ts 92.40% <92.40%> (ø)
packages/models/src/store/index.ts 100.00% <100.00%> (ø)
packages/models/src/utils/helper.ts 86.66% <100.00%> (+20.00%) ⬆️

Continue to review full report in Codecov by Sentry.

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

@Keith-CY Keith-CY merged commit e8561f8 into ckb-js:develop May 19, 2023
@yanguoyu yanguoyu deleted the feat-merge-cells branch November 22, 2023 07:45
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.

5 participants