Skip to content

Fix dynamic type function not receiving correct state for collection - #10398

Open
robe2 wants to merge 1 commit into
pgadmin-org:masterfrom
robe2:fix-mapped-control
Open

Fix dynamic type function not receiving correct state for collection#10398
robe2 wants to merge 1 commit into
pgadmin-org:masterfrom
robe2:fix-mapped-control

Conversation

@robe2

@robe2 robe2 commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

…row fields

When a schema field uses a dynamic type function (type as a function) and is rendered inside a collection (e.g., chain tasks), the function always received the top-level schema data instead of the row-level data. This caused the field to fall through to its default type, ignoring the actual field values in the row.

Pass the parent-path state to the dynamic type function so it receives the correct context for collection row fields.

I ran into this issue when building pg_timetable UI - #10152 that when building a new Chain and Tasks in one step, the Kind toggle didn't change options based on Kind. This patch fixes it, but didn't seem appropriate to put in as part of pg_timetable since it's a global issue. I don't think any existing elements are impacted by it yet.

Summary by CodeRabbit

  • Bug Fixes
    • Improved dynamic field type evaluation for nested form fields.
    • Ensures field types are determined using the appropriate parent field state when applicable.

…row fields

When a schema field uses a dynamic type function (type as a function)
and is rendered inside a collection (e.g., chain tasks), the function
always received the top-level schema data instead of the row-level data.
This caused the field to fall through to its default type, ignoring
the actual field values in the row.

Pass the parent-path state to the dynamic type function so it receives
the correct context for collection row fields.
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 6dc2a35f-ffaf-4f60-917a-af1f6f9100c3

📥 Commits

Reviewing files that changed from the base of the PR and between 0b8e8db and e077347.

📒 Files selected for processing (1)
  • web/pgadmin/static/js/SchemaView/MappedControl.jsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

MappedFormControl now passes the parent field state to function-based field.type evaluation for nested access paths. It continues to pass the current state for single-element paths.

Changes

Mapped control state evaluation

Layer / File(s) Summary
Parent state evaluation
web/pgadmin/static/js/SchemaView/MappedControl.jsx
For nested access paths, MappedFormControl evaluates function-based field.type values with the parent field state. Single-element paths continue to use the current state.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to e0773

Dynamic field types in collection rows now receive row-level context, allowing dependent controls such as Kind options to update correctly without changing top-level field behavior.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing dynamic type functions so they receive the correct state for collection fields.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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