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

Improved move implementation with complex different shapes #41

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

SpOOnman
Copy link
Contributor

I've worked on move with different shapes. This should fix #19 and probably #37

My solution on move is split to four phases:

  • move row to "tmp" index
  • reindex all rows that need to be reindexed
  • move from from "tmp" index do destination index
  • recover as many change, blur and focus functions as it was previously.

Main difference can be spot in moveFieldState function. I delete old field. Previous solution could pollute fields as it was cloning fields with name change. It didn't clean up if shapes didn't match. And not all fields were taken into account since only "source" fields were iterated.

Since I've changed moveFields function some tests were failing. I've also improved swap and insert. Swap is done in the same manner as move, but I'm not sure if I resolved insert properly. Please support me if there is something missing.

Thanks for your great library! :)

@codecov
Copy link

codecov bot commented Sep 18, 2019

Codecov Report

Merging #41 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #41   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     14    +2     
  Lines         139    155   +16     
  Branches       29     33    +4     
=====================================
+ Hits          139    155   +16
Impacted Files Coverage Δ
src/restoreFunctions.js 100% <100%> (ø)
src/move.js 100% <100%> (ø) ⬆️
src/swap.js 100% <100%> (ø) ⬆️
src/moveFieldState.js 100% <100%> (ø) ⬆️
src/insert.js 100% <100%> (ø) ⬆️
src/moveFields.js 100% <100%> (ø)

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 7b37726...32fafdf. Read the comment docs.

@PerfectPixel
Copy link
Contributor

anything we can do about this or #38 @erikras ?

@erikras erikras merged commit 27acc9a into final-form:master Nov 20, 2019
@erikras
Copy link
Member

erikras commented Nov 20, 2019

Published in v3.0.2.

@SpOOnman
Copy link
Contributor Author

Thanks @erikras !

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.

fields.move causes an error when applied to two objects with different set of fields
3 participants