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

Swapping beforeChange and afterSetDataAtCell/afterSetDataAtRowProp hooks order #10231

Merged
merged 12 commits into from Jun 13, 2023

Conversation

wszymanski
Copy link
Contributor

@wszymanski wszymanski commented Feb 3, 2023

Context

So far, there have been called afterSetDataAtCell and afterSetDataAtRowProp hooks, before beforeChange hook. There will be change in that order. What's more, places where editor is closed and nulls created using beforeChange hooks are filtered out have been changed.

It will fix problem described within #6932 as afterSetDataAtCell will handle proper value (right after applying changes from beforeChange hook).

Was:

afterSetDataAtCell/afterSetDataAtRowProp hook -> beforeChange hook -> closing an editor (when necessary - stops next actions) -> async validation -> applying changes -> afterChange hook

Will be (🔴 breaking change):

beforeChange hook -> closing an editor (when necessary + next actions after calling the afterSetData* hook won't be executed) -> afterSetDataAtCell/afterSetDataAtRowProp hook (data changed by beforeChange hooks including effect of splice method, with filtered nulls) -> async validation -> applying changes -> afterChange hook

How has this been tested?

I tested a table by using API methods, such as: afterSetDataAtCell, afterSetDataAtRowProp, populateFromArray and performing autofill, clearing cells or editing them. While dong such actions I have been performing manipulations inside changes array (being a beforeChange hook's argument) by reassignment of array's element or using splice method.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature or improvement (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Additional language file or change to the existing one (translations)

Related issue(s):

  1. Formulas do not calculate if they're used as new values in the beforeChange hook #6932

Affected project(s):

  • handsontable
  • @handsontable/angular
  • @handsontable/react
  • @handsontable/vue
  • @handsontable/vue3

Checklist:

  • I have reviewed the guidelines about Contributing to Handsontable and I confirm that my code follows the code style of this project.
  • My change requires a change to the documentation.

@wszymanski wszymanski changed the title SwappingbeforeChange and afterSetDataAtCell/afterSetDataAtRowProp hooks Swapping beforeChange and afterSetDataAtCell/afterSetDataAtRowProp hooks Feb 3, 2023
@github-actions
Copy link

github-actions bot commented Feb 6, 2023

Launch the local version of documentation by running:

npm run docs:review 573f827d6d564e4d967cc7849a422a678a925d15

@wszymanski wszymanski changed the title Swapping beforeChange and afterSetDataAtCell/afterSetDataAtRowProp hooks Swapping beforeChange and afterSetDataAtCell/afterSetDataAtRowProp hooks order Feb 6, 2023
@wszymanski wszymanski marked this pull request as ready for review February 6, 2023 14:14
handsontable/test/e2e/Core_setDataAtCell.spec.js Outdated Show resolved Hide resolved
handsontable/test/e2e/Core_setDataAtCell.spec.js Outdated Show resolved Hide resolved
handsontable/src/core.js Show resolved Hide resolved
wszymanski and others added 3 commits February 7, 2023 13:17
Co-authored-by: Krzysztof Budnik <571316+budnix@users.noreply.github.com>
Co-authored-by: Krzysztof Budnik <571316+budnix@users.noreply.github.com>
budnix
budnix previously approved these changes Feb 8, 2023
@wszymanski wszymanski merged commit 711587b into develop Jun 13, 2023
32 checks passed
@wszymanski wszymanski deleted the feature/dev-issue-677 branch June 13, 2023 07:36
@aninde
Copy link
Contributor

aninde commented Jun 20, 2023

I made sure that the new order of hooks also works for merging, opening the editor after crud operations, with undo and redo.
In addition, it turns out that v13 improves:
https://github.com/handsontable/dev-handsontable/issues/915
https://github.com/handsontable/dev-handsontable/issues/935

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants