Skip to content

fix(modal-fields): render user fields assigned to the basic group (issue #2045)#2052

Open
ther12k wants to merge 1 commit into
callumalpass:mainfrom
ther12k:fix/issue-2045-user-fields-in-basic-group
Open

fix(modal-fields): render user fields assigned to the basic group (issue #2045)#2052
ther12k wants to merge 1 commit into
callumalpass:mainfrom
ther12k:fix/issue-2045-user-fields-in-basic-group

Conversation

@ther12k

@ther12k ther12k commented Jun 21, 2026

Copy link
Copy Markdown

Summary

When a user assigns a custom (user-typed) field to the 'Basic Information' group via the Modal Fields settings, the field silently disappears. The cause was a hardcoded skip in renderTaskModalFieldGroups:

if (groupConfig.id === "basic") {
    continue;
}

The skip was originally added to avoid double-rendering the built-in basic fields (title, details), which have dedicated creation paths in TaskModal (createTitleInput, detailsMarkdownEditor). Unfortunately, the same skip also discarded any user field the user moved into the basic group.

This change:

  1. Removes the hardcoded basic-group skip.
  2. Relies on the existing renderTaskModalField dispatcher to silently drop core basic fields (they are not in fieldRenderers, and they are not user fields, so renderTaskModalField returns false and they get counted in ignoredFieldIds). Their UI surfaces remain unchanged because the dedicated creation paths still run elsewhere.
  3. Lets user fields in the basic group render through renderUserField exactly like they do in every other group.
  4. Adds a guard at the end of the group loop that removes an empty task-modal__field-group container when the group produced zero rendered fields. This keeps the DOM clean for the basic group when it contains only core fields, and is also defensive against any future group whose fields are all core-only.

Tests

Updates tests/unit/modals/taskModalFieldRenderer.test.ts to reflect the new (correct) behavior — the previous expectations encoded the bug. Both tests now correctly report title/details as ignored, and assert that empty group containers are removed.

Adds tests/unit/issues/issue-2045-user-fields-in-basic-group.test.ts with three cases:

  • User field moved into the basic group renders through renderUserField
  • Groups whose fields all render keep their container (no regression)
  • Core-only basic group produces no leftover empty container

All new + updated tests pass. Full tests/unit/modals suite (37 suites, 187 tests) passes. tsc --noEmit --skipLibCheck clean. npm run lint clean.

Verification

npm install
node generate-release-notes-import.mjs
npx tsc -noEmit --skipLibCheck
npx jest tests/unit/modals --no-coverage
node scripts/run-lint.mjs

Note

This PR is separate from PR #2051 (issue #2046 NLP input autofocus). They were developed in parallel as independent fixes.

…sue callumalpass#2045)

When a user assigned a custom (user-typed) field to the 'Basic Information'
group via the Modal Fields settings, the field silently disappeared. The
cause was a hardcoded skip in renderTaskModalFieldGroups:

    if (groupConfig.id === 'basic') { continue; }

The skip was originally added to avoid double-rendering the built-in basic
fields (title, details), which have dedicated creation paths in TaskModal
(createTitleInput, detailsMarkdownEditor). Unfortunately, the same skip
also discarded any user field the user moved into the basic group.

This change:
  1. Removes the hardcoded basic-group skip.
  2. Relies on the existing renderTaskModalField dispatcher to silently
     drop core basic fields (they are not in fieldRenderers, and they are
     not user fields, so renderTaskModalField returns false and they get
     counted in ignoredFieldIds). Their UI surfaces remain unchanged
     because the dedicated creation paths still run elsewhere.
  3. Lets user fields in the basic group render through renderUserField
     exactly like they do in every other group.
  4. Adds a guard at the end of the group loop that removes an empty
     task-modal__field-group container when the group produced zero
     rendered fields. This keeps the DOM clean for the basic group when
     it contains only core fields, and is also defensive against any
     future group whose fields are all core-only.

Updates tests/unit/modals/taskModalFieldRenderer.test.ts to reflect the
new (correct) behavior — the previous expectations encoded the bug. Both
tests now correctly report title/details as ignored, and assert that
empty group containers are removed.

Adds tests/unit/issues/issue-2045-user-fields-in-basic-group.test.ts with
three cases:
  - user field moved into the basic group renders through renderUserField
  - groups whose fields all render keep their container (no regression)
  - core-only basic group produces no leftover empty container

Closes callumalpass#2045
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.

1 participant