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

fix(core): array field insert method crash in sparse array #3987

Conversation

dan0314
Copy link
Contributor

@dan0314 dan0314 commented Oct 10, 2023

Before submitting a pull request, please make sure the following is done...

  • Ensure the pull request title and commit message follow the Commit Specific in English.
  • Fork the repo and create your branch from master or formily_next.
  • If you've added code that should be tested, add tests!
  • If you've changed APIs, update the documentation.
  • Ensure the test suite passes (npm test).
  • Make sure your code lints (npm run lint) - we've done our best to make sure these rules match our internal linting guidelines.

Please do not delete the above content


What have you changed?

#3932

@CLAassistant
Copy link

CLAassistant commented Oct 10, 2023

CLA assistant check
All committers have signed the CLA.

@dan0314 dan0314 changed the title fix(core): In Sparse Array, the array field insertion method crashes fix(core): fix(core): array field insert method crash in sparse array Oct 10, 2023
@dan0314 dan0314 changed the title fix(core): fix(core): array field insert method crash in sparse array fix(core): array field insert method crash in sparse array Oct 10, 2023
@dan0314 dan0314 force-pushed the fix/core-patch-field-states-in-lazy-array branch from f8f3527 to c68d550 Compare October 10, 2023 10:39
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (8861ef5) 99.55% compared to head (3915838) 99.55%.
Report is 7 commits behind head on formily_next.

Additional details and impacted files
@@              Coverage Diff              @@
##           formily_next    #3987   +/-   ##
=============================================
  Coverage         99.55%   99.55%           
=============================================
  Files               152      152           
  Lines              6709     6716    +7     
  Branches           1876     1819   -57     
=============================================
+ Hits               6679     6686    +7     
- Misses               29       30    +1     
+ Partials              1        0    -1     
Files Coverage Δ
packages/core/src/shared/internals.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -167,6 +167,11 @@ export const patchFieldStates = (
}
}
})
Object.keys(target).forEach((id)=> {
if(target[id] === undefined){
delete target[id]
Copy link
Collaborator

Choose a reason for hiding this comment

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

问题的原因是没有 delete?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

undefined在这炸了

Copy link
Collaborator

Choose a reason for hiding this comment

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

那加个问号是不是就行了?这个 PR 的改动逻辑时间复杂度有点高

@dan0314 dan0314 force-pushed the fix/core-patch-field-states-in-lazy-array branch from c68d550 to 3915838 Compare October 12, 2023 09:18
@janryWang janryWang closed this Oct 17, 2023
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