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

Refactor/rules handling #26

Merged
merged 4 commits into from Dec 29, 2021
Merged

Refactor/rules handling #26

merged 4 commits into from Dec 29, 2021

Conversation

pr0gramista
Copy link
Owner

Description

The problem with rules is that it is impossible to figure out if rules have actually been changed between builds and because rules have been a part of field data it was considered as a change for that field.

This allowed to easily get into an infinite rendering loop.

This PR will separate field rules from field data, thus providing the ability to prevent unnecessary build triggers and ignore rules changes since those are not actually needed for rendering and are not really a part of the state either.

Updating rules by programmatically on SuperForm instance never made much sense for fields that have their widgets so there is no need to implement listening on that. If there would be a need for that it would probably be exposed via onRulesChange callback similar to onChange

Consider this bug fix as a minor breaking change.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@pr0gramista pr0gramista added the bug Something isn't working label Dec 28, 2021
@codecov
Copy link

codecov bot commented Dec 28, 2021

Codecov Report

Merging #26 (ccaaf49) into master (1f7a543) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #26   +/-   ##
=======================================
  Coverage   99.83%   99.84%           
=======================================
  Files          13       13           
  Lines         624      645   +21     
=======================================
+ Hits          623      644   +21     
  Misses          1        1           
Impacted Files Coverage Δ
lib/src/fields/checkbox_super_form_field.dart 100.00% <100.00%> (ø)
lib/src/fields/dropdown_super_form_field.dart 100.00% <100.00%> (ø)
lib/src/fields/radio_super_form_field.dart 100.00% <100.00%> (ø)
lib/src/fields/slider_super_form_field.dart 100.00% <100.00%> (ø)
lib/src/fields/text_super_form_field.dart 100.00% <100.00%> (ø)
lib/src/super_form.dart 100.00% <100.00%> (ø)
lib/src/super_form_field.dart 100.00% <100.00%> (ø)
... and 3 more

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 1f7a543...ccaaf49. Read the comment docs.

@pr0gramista pr0gramista merged commit 31210d5 into master Dec 29, 2021
@pr0gramista pr0gramista deleted the refactor/rules-handling branch December 29, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant