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

Replace components with renderer package #798

Merged
merged 18 commits into from
Mar 5, 2025

Conversation

sergei-maertens
Copy link
Member

@sergei-maertens sergei-maertens commented Feb 28, 2025

Part of #445

Trying out @open-formulieren/formio-renderer, checking for visual regressions.

  • Use CSS from package rather than defining our own. It was ported from the SDK to the library.
  • Replace EmailField component with TextField type="email"
  • Replace TextField from package instead of our own
  • Replace RadioField from package instead of our own

TODO:

  • Replace DateField usage where the inputgroup widget is used
  • Replace helpers usage (Label, LabelContent, HelpText, ValidationErrors...)

To decide:

validate on blur has the annoying side effect that backend validation errors dissapear once the field gets focused, so it's probably wise to only validate on submit 🤔

Copy link

codecov bot commented Feb 28, 2025

Bundle Report

Changes will increase total bundle size by 24.22kB (0.25%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
@open-formulieren/sdk-OpenForms-umd 4.79MB 12.11kB (0.25%) ⬆️
@open-formulieren/sdk-esm 4.76MB 12.11kB (0.25%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: @open-formulieren/sdk-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/formio-*.js -46 bytes 2.03MB -0.0%
assets/sdk-*.js 5.23kB 1.01MB 0.52%
assets/index-*.js 6.03kB 31.3kB 23.85% ⚠️
assets/nl-*.js 471 bytes 23.85kB 2.01%
assets/en-*.js 428 bytes 22.93kB 1.9%

Files in assets/sdk-*.js:

  • ./src/components/forms/Checkbox/Checkbox.jsx → Total Size: 1.77kB

  • ./src/components/EmailVerification/EmailVerificationForm.jsx → Total Size: 5.91kB

  • ./src/components/EmailVerification/ModeField.jsx → Total Size: 742 bytes

  • ./src/components/formio/FormioComponent.jsx → Total Size: 832 bytes

  • ./src/components/formio/checkbox.jsx → Total Size: 560 bytes

  • ./src/components/forms/DateField/DateField.jsx → Total Size: 2.17kB

  • ./src/components/forms/DateField/DatePicker.jsx → Total Size: 4.75kB

Files in assets/index-*.js:

  • ./src/components/appointments/steps/ContactDetailsStep.jsx → Total Size: 3.25kB

  • ./src/components/appointments/cancel/CancelAppointment.jsx → Total Size: 5.5kB

view changes for bundle: @open-formulieren/sdk-OpenForms-umd

Assets Changed:

Asset Name Size Change Total Size Change (%)
open-*.js 12.11kB 3.5MB 0.35%

Files in open-*.js:

  • ./src/components/EmailVerification/ModeField.jsx → Total Size: 742 bytes

  • ./src/components/forms/Checkbox/Checkbox.jsx → Total Size: 1.78kB

  • ./src/components/forms/DateField/DatePicker.jsx → Total Size: 4.75kB

  • ./src/components/appointments/steps/ContactDetailsStep.jsx → Total Size: 3.26kB

  • ./src/components/appointments/cancel/CancelAppointment.jsx → Total Size: 5.5kB

  • ./src/components/EmailVerification/EmailVerificationForm.jsx → Total Size: 5.91kB

  • ./src/components/formio/checkbox.jsx → Total Size: 562 bytes

  • ./src/components/formio/FormioComponent.jsx → Total Size: 836 bytes

  • ./src/components/forms/DateField/DateField.jsx → Total Size: 2.17kB

Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.37%. Comparing base (adf8ff7) to head (c2b5722).
Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #798      +/-   ##
==========================================
- Coverage   83.99%   83.37%   -0.63%     
==========================================
  Files         246      233      -13     
  Lines        4817     4607     -210     
  Branches     1275     1187      -88     
==========================================
- Hits         4046     3841     -205     
+ Misses        742      736       -6     
- Partials       29       30       +1     
Flag Coverage Δ
storybook 76.61% <92.85%> (-0.99%) ⬇️
vitest 62.45% <90.00%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@sergei-maertens sergei-maertens marked this pull request as ready for review February 28, 2025 11:03
@sergei-maertens sergei-maertens force-pushed the experiment/replace-formio-in-appointments branch from 80bccf0 to 22268a8 Compare February 28, 2025 12:02
@sergei-maertens sergei-maertens marked this pull request as draft February 28, 2025 12:52
This is being replaced with our own renderer.
This way we can catch visual regressions on existing stories.
Eventually, the stories can be removed.
Because we now rely on subpackages installed via npm which also include
translations strings, message compilation is now a shell script taking
those locations into account.

This setup is identical to to open-forms backend + formio-builder
package.
This now uses the FormioForm component from the library, simplifying
the code required here. Some bits and pieces are still missing:

* existing values are not passed in as submission values/data
* date errors and touched state is not going right
* phone number has an invalite pattern for validation (HTML error)
* the initial errors prop is now not passed to be able to display
  backend errors
And remove our own implementation.
It has been replaced with the component from @open-formulieren/formio-renderer
This addressed some shortcomings that we need for the appointments
flow.
@sergei-maertens sergei-maertens force-pushed the experiment/replace-formio-in-appointments branch from 97230bf to 6363668 Compare March 1, 2025 20:59
@sergei-maertens sergei-maertens marked this pull request as ready for review March 1, 2025 21:07
…mponents

This code would otherwise be duplicated. The raw React components
still require migrating to the formio-renderer package, so those
usages will also disappear over time.
The datepicker/calendar variant is not ported yet and will follow later,
but the input group code can be removed since it has been implemented
in the renderer package already.
@sergei-maertens sergei-maertens force-pushed the experiment/replace-formio-in-appointments branch from 57feb54 to c2b5722 Compare March 5, 2025 12:02
@sergei-maertens sergei-maertens merged commit 4eed457 into main Mar 5, 2025
15 of 17 checks passed
@sergei-maertens sergei-maertens deleted the experiment/replace-formio-in-appointments branch March 5, 2025 12:44
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.

2 participants