Skip to content

Add defensive guards and refactor in PA - #2923

Open
maggie-li-yd wants to merge 4 commits into
developfrom
maggie-li-yd/2872-a1-ui-robustness
Open

Add defensive guards and refactor in PA#2923
maggie-li-yd wants to merge 4 commits into
developfrom
maggie-li-yd/2872-a1-ui-robustness

Conversation

@maggie-li-yd

@maggie-li-yd maggie-li-yd commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Prerequisite refactor split out of maggie-li-yd/2872-webmcp-poc. No functional change to existing UI flows.

  • Extract value normalization out of useDashboardFlow into utils/applyConstraintValue.ts so the wizard flow and the (upcoming) WebMCP patch applier share one normalizer. Reject objects that are neither a {from,to} date range nor a numeric value instead of String()-ing them into a broken '[object Object]' filter.
  • StackBarChart: null-guard filterCard?.name so a category referencing a no-longer-chartable filter card can't crash the whole chart render.
  • BaseTagInput: coerce displayValue to String() so a numeric constraint value doesn't throw in .replace().

Merge Checklist

Please cross check this list if additions / modifications needs to be done on top of your core changes and tick them off. Reviewer can as well glance through and help the developer if something is missed out.

  • Automated Tests (Jasmine integration tests, Unit tests, and/or Performance tests)
  • Updated Manual tests / Demo Config
  • Documentation (Application guide, Admin guide, Markdown, Readme and/or Wiki)
  • Verified that local development environment is working with latest changes (integrated with latest develop branch)
  • following best practices in code review doc

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and hardens constraint/value handling in the Vue MRI UI library, aiming to share one normalization path between the dashboard wizard flow and an upcoming WebMCP patch applier while preventing UI crashes from unexpected/missing values.

Changes:

  • Extracted constraint value normalization + store dispatching into a shared applyConstraintValue utility.
  • Added defensive guards in UI components to avoid runtime errors from unexpected null/number values.
  • Updated dashboard flow to delegate normalization logic to the shared utility.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
plugins/ui/apps/vue-mri-ui-lib/src/utils/applyConstraintValue.ts New shared constraint value normalizer/dispatcher used by dashboard flow (and future WebMCP applier).
plugins/ui/apps/vue-mri-ui-lib/src/lib/ui/BaseTagInput.vue Coerces displayed tag value to string to avoid .replace() throwing on non-strings.
plugins/ui/apps/vue-mri-ui-lib/src/composables/useDashboardFlow.ts Replaces inlined normalization logic with the shared applyConstraintValue utility.
plugins/ui/apps/vue-mri-ui-lib/src/components/StackBarChart.vue Adds null-guard for missing filter-card names to prevent chart render crashes.

Comment thread plugins/ui/apps/vue-mri-ui-lib/src/lib/ui/BaseTagInput.vue Outdated
Comment thread plugins/ui/apps/vue-mri-ui-lib/src/components/StackBarChart.vue Outdated
Comment thread plugins/ui/apps/vue-mri-ui-lib/src/utils/applyConstraintValue.ts Outdated
Comment thread plugins/ui/apps/vue-mri-ui-lib/src/utils/applyConstraintValue.ts Outdated
Comment thread plugins/ui/apps/vue-mri-ui-lib/src/utils/applyConstraintValue.ts
maggie-li-yd and others added 3 commits July 24, 2026 09:59
Prerequisite refactor split out of maggie-li-yd/2872-webmcp-poc (PR A1). No
functional change to existing UI flows.

- Extract value normalization out of useDashboardFlow into
  utils/applyConstraintValue.ts so the wizard flow and the (upcoming) WebMCP
  patch applier share one normalizer. Reject objects that are neither a
  {from,to} date range nor a numeric value instead of String()-ing them into
  a broken '[object Object]' filter.
- StackBarChart: null-guard filterCard?.name so a category referencing a
  no-longer-chartable filter card can't crash the whole chart render.
- BaseTagInput: coerce displayValue to String() so a numeric constraint value
  doesn't throw in .replace().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

WebMCP POC

3 participants