Skip to content

Move the recurrence modal off TanStack Form - #254

Merged
sneridagh merged 4 commits into
feat/form-migrationfrom
feat/recurrence-form-store
Oct 10, 2026
Merged

sneridagh merged 4 commits into
feat/form-migrationfrom
feat/recurrence-form-store

Conversation

@sneridagh

@sneridagh sneridagh commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Last part of step 6 of #244. Stacked on #253. After this, nothing in the repo uses @tanstack/react-form, and it's gone from the lockfile.

Changes

  • Recurrence modal: its own form (frequency, interval, days, end…) uses useFormStore from @plone/helpers instead of a TanStack form.
    • Its 16 form.AppField blocks become the field components with onChange={setField('name')}.
    • The 3 form.Subscribe blocks read the values the modal already subscribes to.
    • The modal's form is not provided as the current form (no FormProvider), so UntilEndField keeps reading the event's end from the content form.
  • The 9 field components take a plain onChange(value). None of them passed a function updater.
  • @plone/cmsui drops the @tanstack/react-form dependency and its optimizeDeps entry.

Recurrence date fix

The "until" date crash this PR originally fixed has landed on main separately in #255, together with the widget's acceptance test. After the update from main, this PR only contains the TanStack migration.

Not fixed here

The widget's edit and delete buttons, and the modal's submit button, are icon-only with no accessible name. The acceptance test locates them by position. Worth a follow-up (#243 step 5 touches this widget anyway).

Tests

  • New acceptance/tests/recurrence-widget.test.ts, the first for this widget: open the modal, choose Weekly, apply, see the rule in the widget, save the event, and check that recurrence contains FREQ=WEEKLY through the REST API. (It came in with Fix the recurrence modal crash for events ending on days 1 to 9 #255.)
  • New unit test for toISODate.
  • Full acceptance suite (local, dev mode): 207 passed, 0 failed. cmsui: 212 unit tests pass; type-check, lint and the optimizeDeps audit are clean.

The recurrence modal's own form now uses a form store from
@plone/helpers. It is not provided as the current form, so the fields in
the modal still read the event's start and end from the content form.
The field components take plain onChange(value) setters instead of
TanStack updaters. With that, nothing uses @tanstack/react-form anymore,
and cmsui drops the dependency.

Also fixes the modal crashing the edit form for events that end on days
1 to 9 of a month: the default "until" date was built without padding
the day (2026-10-5), which is not a valid ISO date. Adds the first
acceptance test for the recurrence widget.

Refs #244
…ecurrence-form-store

* origin/feat/form-migration:
  Fix the indentation of the jotai/vanilla optimizeDeps entry
…ecurrence-form-store

* origin/feat/form-migration:
  Fix the recurrence modal crash for events ending on days 1 to 9 (#255)
…ecurrence-form-store

* origin/feat/form-migration:
  Explain where controls and widgets live in the widgets guide
@sneridagh

Copy link
Copy Markdown
Member Author

LGTM

@sneridagh
sneridagh added this pull request to stack #258 October 9, 2026 16:21
@sneridagh
sneridagh requested a review from pnicolli October 9, 2026 19:40
@sneridagh
sneridagh merged commit 3f6b610 into main Oct 10, 2026
39 checks passed
@sneridagh
sneridagh deleted the feat/recurrence-form-store branch October 10, 2026 22:38
sneridagh added a commit that referenced this pull request Oct 10, 2026
* origin/main:
  Validate schema-driven forms (#256)
  Move the recurrence modal off TanStack Form (#254)
  Move the forms onto the helpers form store (#253)
  Add a Jotai-native form layer to helpers (#252)
  Render every schema form through one field renderer (#251)
  Document and type the form widget contract (#97)
  Match utility dependencies exactly in the registry (#259)

# Conflicts:
#	packages/cmsui/config/widgets.ts
sneridagh added a commit that referenced this pull request Oct 10, 2026
…widget-context

* origin/feat/widget-adapters:
  Restore files the pre-commit hook reformatted
  Validate schema-driven forms (#256)
  Move the recurrence modal off TanStack Form (#254)
  Move the forms onto the helpers form store (#253)
  Add a Jotai-native form layer to helpers (#252)
  Render every schema form through one field renderer (#251)
  Document and type the form widget contract (#97)
  Match utility dependencies exactly in the registry (#259)
sneridagh added a commit that referenced this pull request Oct 10, 2026
…yped-widget-registry

* origin/feat/widget-context:
  Restore files the pre-commit hook reformatted
  Validate schema-driven forms (#256)
  Move the recurrence modal off TanStack Form (#254)
  Move the forms onto the helpers form store (#253)
  Add a Jotai-native form layer to helpers (#252)
  Render every schema form through one field renderer (#251)
  Document and type the form widget contract (#97)
  Match utility dependencies exactly in the registry (#259)
sneridagh added a commit that referenced this pull request Oct 10, 2026
… feat/missing-widgets

* origin/feat/typed-widget-registry:
  Restore files the pre-commit hook reformatted
  Validate schema-driven forms (#256)
  Move the recurrence modal off TanStack Form (#254)
  Move the forms onto the helpers form store (#253)
  Add a Jotai-native form layer to helpers (#252)
  Render every schema form through one field renderer (#251)
  Document and type the form widget contract (#97)
  Match utility dependencies exactly in the registry (#259)
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