Skip to content

[CSM Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme - #1356

Merged
Rashmika998 merged 5 commits into
wso2-open-operations:mainfrom
2003dinijay:fix/assigned-to-me-parity-and-ui
Aug 4, 2026
Merged

Rashmika998 merged 5 commits into
wso2-open-operations:mainfrom
2003dinijay:fix/assigned-to-me-parity-and-ui

Conversation

@2003dinijay

@2003dinijay 2003dinijay commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • dashboard.ts: the "Assigned to me" widget's query already matched the webapp's useGetMyAssignedOpenCases (same assignedUserId/state/type filters, same sort) — added the missing staleTime: 30_000 for full parity. Preview trimmed from 5 to 4 cases (the rest are a "View all" tap away).
  • CaseDetailPage.tsx: invalidateCase() (run after every state/assignment/workState change or comment) only invalidated ["case", id]/["cases"], never ["dashboard", ...]. Home's "Assigned to me"/composition widgets use that disjoint key prefix, so actions taken on the case detail page left Home showing stale data until the widget's own staleTime lapsed. Now invalidates ["dashboard"] too.
  • AssignedToMeSection.tsx: added a "View all" link deep-linking to Support pre-filtered to assignedToMe=1 (mirrors the webapp's MyAssignedCases VIEW_ALL_HREF), shown only when there's something to see more of.
  • Fixed a cramped mobile header: the webapp packs title/View all/Last refreshed/refresh icon into one row, which works on a wide desktop card but crushed the title into wrapping at phone width. Split into two rows — title + refresh icon on top, View all + Last refreshed below. Removed RefreshButton.tsx, now dead code after inlining the icon button directly.
  • theme/index.ts: switched the brand theme from AcrylicOrangeTheme to AcrylicPurpleTheme (both first-class @wso2/oxygen-ui exports, matching the webapp) — purple primary, gradient buttons, purple-tinted acrylic background.
  • TopBar.tsx: the "Go to Apps" exit button was styled color="error" (MUI's semantic red slot, not actually tied to the old orange brand) — switched to color="primary" so it follows the new theme. The dialog's "Leave" confirm button stays red — that's a legitimate exit-warning color, not a branding choice.

Test plan

  • tsc --noEmit passes
  • eslint passes (4 pre-existing errors remain in untouched files, unrelated to this PR)
  • npm run build passes
  • Verified live in the app: Home's "Assigned to me" widget renders real assigned cases (4 preview + "View all"), navigates to Support pre-filtered correctly, two-row header no longer wraps, purple theme applied throughout, "Go to Apps" no longer reads red

… case actions

dashboard.ts's assignedToMe already sent the same filters/sort/limit as the
webapp's useGetMyAssignedOpenCases; add the missing 30s staleTime to match it
exactly.

CaseDetailPage's invalidateCase() only invalidated ["case", id] and ["cases"]
after a mutation (state/assignment/workState change, comment) -- Home's
"Assigned to me"/composition widgets key off a disjoint ["dashboard", ...]
prefix, so those actions left Home showing stale data until the widget's own
staleTime lapsed. Invalidate ["dashboard"] there too.
Deep-links to Support pre-filtered to assignedToMe=1 (mirrors the webapp's
MyAssignedCases VIEW_ALL_HREF), shown only once there's something to see
more of.

The webapp packs title/View all/Last refreshed/refresh icon into one row --
fine on a wide desktop card, but on phone width that was crushing the title
itself into wrapping. Split into two rows instead: title + refresh icon on
top, View all + Last refreshed below. Inlines the icon button directly
(dropping the now-unused RefreshButton component) since it no longer needs
to bundle the "last refreshed" text with the icon.
Copilot AI lite review requested due to automatic review settings August 4, 2026 13:10
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces the standalone RefreshButton component with inline refresh controls, a "View all" deep-link, and last-refreshed metadata inside AssignedToMeSection. It updates dashboard.assignedToMe to handle a missing user ID explicitly, adds dashboard query invalidation after case mutations in CaseDetailPage, and reformats an unrelated expression in SupportPage.

Changes

Assigned-to-me widget update

Layer / File(s) Summary
Remove RefreshButton, add inline refresh and deep-link
apps/csm-portal/microapp/src/components/home/AssignedToMeSection.tsx, apps/csm-portal/microapp/src/components/home/RefreshButton.tsx
RefreshButton is deleted. AssignedToMeSection adds a tooltip-wrapped refresh icon, a Support deep-link for viewing all assigned cases, relative last-refreshed text, and a two-row header layout for narrow screens.
Dashboard query and cache invalidation
apps/csm-portal/microapp/src/services/dashboard.ts, apps/csm-portal/microapp/src/pages/CaseDetailPage.tsx
dashboard.assignedToMe returns EMPTY_RESULT when no user ID exists and sets an explicit 30-second stale time. invalidateCase now also invalidates ["dashboard"] query keys after case mutations.
SupportPage list expression reformat
apps/csm-portal/microapp/src/pages/SupportPage.tsx
The case-item flattening and sort logic in CaseListContent is reformatted into a multiline chain with no behavior change.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested labels: Type/Bug, Area/Frontend

Suggested reviewers: rashmika998, cloby99

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description covers purpose, goals, approach, and test results, but omits required sections like Release note, Documentation, Security checks, and Test environment. Add missing required template sections: Release note, Documentation, Security checks, and Test environment details to complete the description.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title accurately describes the main changes: fixing the Home's Assigned to me widget for fetch parity, freshness, mobile layout, and theme updates.
✨ 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.

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

Improves the Home “Assigned to me” dashboard widget so it stays fresh and matches the webapp behavior, including query freshness parity, correct cache invalidation after case mutations, and a more usable mobile header layout.

Changes:

  • Add staleTime: 30_000 to the dashboard “assigned to me” query for parity with the webapp hook.
  • Invalidate ["dashboard"] queries after case mutations so Home widgets update immediately after actions taken on the case detail page.
  • Update the Home “Assigned to me” widget UI: add conditional “View all” deep-link to Support and split the header into two rows for mobile; remove now-dead RefreshButton component.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
apps/csm-portal/microapp/src/services/dashboard.ts Adds 30s staleTime and minor refactor for the “assigned to me” query to match webapp freshness behavior.
apps/csm-portal/microapp/src/pages/SupportPage.tsx Formatting-only change for readability of client-side sorting pipeline.
apps/csm-portal/microapp/src/pages/CaseDetailPage.tsx Ensures case mutations invalidate ["dashboard"] queries so Home widgets don’t remain stale.
apps/csm-portal/microapp/src/components/home/AssignedToMeSection.tsx Adds “View all” navigation + mobile-friendly header layout; inlines refresh icon button behavior.
apps/csm-portal/microapp/src/components/home/RefreshButton.tsx Removes unused component after inlining refresh control.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/csm-portal/microapp/src/components/home/AssignedToMeSection.tsx Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/csm-portal/microapp/src/services/dashboard.ts`:
- Around line 79-90: Update the enabled flag in the assignedToMe queryOptions to
distinguish between null and undefined userId values. Change enabled from
checking !!userId to only disable when userId is undefined, allowing the query
to run and reach the if (!userId) check inside queryFn when userId is null. This
way the queryFn's early-return logic will properly execute and return the
EMPTY_RESULT promise for the empty state instead of the query staying pending.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ff244ff9-be0d-41c0-9128-8a8b094ba792

📥 Commits

Reviewing files that changed from the base of the PR and between 93096d4 and 8563782.

📒 Files selected for processing (5)
  • apps/csm-portal/microapp/src/components/home/AssignedToMeSection.tsx
  • apps/csm-portal/microapp/src/components/home/RefreshButton.tsx
  • apps/csm-portal/microapp/src/pages/CaseDetailPage.tsx
  • apps/csm-portal/microapp/src/pages/SupportPage.tsx
  • apps/csm-portal/microapp/src/services/dashboard.ts
💤 Files with no reviewable changes (1)
  • apps/csm-portal/microapp/src/components/home/RefreshButton.tsx

Comment thread apps/csm-portal/microapp/src/services/dashboard.ts
Swap AcrylicOrangeTheme for AcrylicPurpleTheme, both first-class exports of
@wso2/oxygen-ui (confirmed byte-identical between the webapp's and this app's
installed package versions, so no version bump needed) -- primary #646cff,
gradient buttons, purple-tinted acrylic background, same as the webapp.

TopBar's "Go to Apps" exit button was styled color="error" (MUI's semantic
red slot, not actually tied to the old orange brand) -- switch it to
color="primary" so it follows the new theme instead of reading as a stray
red accent. The confirm dialog's "Leave" button stays error/red: that one is
a legitimate exit-warning color, not a branding choice.
The rest are a "View all" tap away on Support, so the preview only needs
enough rows to be useful at a glance, not a fifth partial row of card content
pushing the composition donuts further down the page.
data?.items is the live cache reference react-query hands back, not a fresh
array -- sort() mutates in place, which can produce surprising behavior for
other subscribers/devtools and breaks the "cache data is immutable" contract.
Spread into a new array first, matching what SupportPage.tsx's equivalent
sort already gets for free via flatMap.

Addresses Copilot review comment on wso2-open-operations#1356.
@2003dinijay 2003dinijay changed the title Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout [Csm Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme/e Aug 4, 2026
@2003dinijay 2003dinijay changed the title [Csm Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme/e [Csm Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme Aug 4, 2026
@2003dinijay 2003dinijay changed the title [Csm Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme [CSM Portal Microapp] Fix Home's Assigned to me widget: fetch parity, freshness, and mobile layout/ Theme Aug 4, 2026
@Rashmika998
Rashmika998 merged commit 8cefb6f into wso2-open-operations:main Aug 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants