Skip to content

[6.x] Fix fieldtype picker showing wrong list after switching blueprint modes - #14919

Merged
jasonvarga merged 1 commit into
6.xfrom
fieldtype-selector-mode-cache
Jul 2, 2026
Merged

[6.x] Fix fieldtype picker showing wrong list after switching blueprint modes#14919
jasonvarga merged 1 commit into
6.xfrom
fieldtype-selector-mode-cache

Conversation

@duncanmcclean

@duncanmcclean duncanmcclean commented Jul 2, 2026

Copy link
Copy Markdown
Member

This pull request fixes an issue where the fieldtype picker shows the wrong list of fieldtypes after switching between a form blueprint and a regular blueprint (until a full page reload).

This was happening because the picker caches its fieldtype list in a module-level singleton shared across every instance, but the two modes request different lists — regular blueprints fetch all selectable fieldtypes, while form blueprints fetch a smaller list that respects Fieldtype::makeUnselectableInForms(). Since the cache was only checked for "is it an array?", the first picker to load won, and every later picker early-returned regardless of its blueprint mode. Reloading fixed it because the module state reset.

This PR fixes it by keying the cache on the blueprint mode. The cache now stores { forms, data } and is only treated as loaded when the cached mode matches the current picker's mode, otherwise it refetches the correct list. Cross-picker caching is preserved within a mode.

FWIW: I've removed isFormBlueprint on the forms-2 branch because forms won't be using blueprints with the new form builder / form fieldtypes system.

Fixes #14903

Key the shared fieldtype cache on the blueprint mode so form and regular
blueprints refetch the correct list instead of reusing whichever loaded first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jasonvarga
jasonvarga merged commit aae06c7 into 6.x Jul 2, 2026
23 checks passed
@jasonvarga
jasonvarga deleted the fieldtype-selector-mode-cache branch July 2, 2026 16:21
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.

Fieldtype picker shows the wrong list after switching between form and regular blueprints (until reload)

2 participants