Skip to content

Fixes Appointment slots query cache key omits resource type/id - #16595

Open
pratx08 wants to merge 5 commits into
ohcnetwork:developfrom
pratx08:ISSUE-16518
Open

Fixes Appointment slots query cache key omits resource type/id#16595
pratx08 wants to merge 5 commits into
ohcnetwork:developfrom
pratx08:ISSUE-16518

Conversation

@pratx08

@pratx08 pratx08 commented Jul 23, 2026

Copy link
Copy Markdown

Proposed Changes

Fixes #16518

Include resourceType and the resolved resource ID in the appointment slots query key.
Reuse the same resolved resource ID in both the query key and request body.
Prevent cached availability from one resource being temporarily displayed for another resource at the same facility and date.
No behavior changes beyond correctly scoping the TanStack Query cache.

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes.

Summary by CodeRabbit

Summary

  • Bug Fixes
    • Improved appointment day-slot loading by deriving a single, consistent resource identifier used for both the day-slots request and the related cached results.
    • Updated availability caching to account for resource type and the selected date range, reducing stale or mismatched slot displays when filters change.

@pratx08
pratx08 requested review from a team July 23, 2026 16:17
@github-actions

Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 01606bfd-2913-4ad6-bd7e-4af1f228208b

📥 Commits

Reviewing files that changed from the base of the PR and between d9d5220 and 016b8f0.

📒 Files selected for processing (1)
  • src/pages/Appointments/AppointmentsPage.tsx

Walkthrough

Changes

Appointment slots query

Layer / File(s) Summary
Resolve and scope slots resource
src/pages/Appointments/AppointmentsPage.tsx
Derives resourceIds from resourceId or filtered practitioners, then includes it with resourceType and date_from in the query key and request payload.

Suggested labels: needs testing, needs review
Suggested reviewers: amjithtitus09, jacobjeevan, nikhila8606

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the cache-key fix for appointment slots.
Description check ✅ Passed The description matches the template with Proposed Changes, issue reference, tagging, and a merge checklist.
Linked Issues check ✅ Passed The change includes resourceType and the resolved resource_id in the slots query key and keeps request body aligned with the issue.
Out of Scope Changes check ✅ Passed The PR stays focused on scoping the appointment slots cache key and request body, with no unrelated changes shown.
✨ 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.

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown

Greptile Summary

Correctly scopes appointment-slot caching to the resolved scheduling resource.

  • Adds the resource type and resolved resource ID to the TanStack Query cache key.
  • Reuses the same resolved resource ID in the slot request body.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/pages/Appointments/AppointmentsPage.tsx Updates the slot query key and request body to consistently use the selected scheduling resource identity without introducing a blocking failure.

Reviews (3): Last reviewed commit: "Merge branch 'ISSUE-16518' of https://gi..." | Re-trigger Greptile

@NikhilA8606

NikhilA8606 commented Jul 24, 2026

Copy link
Copy Markdown
Member

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

* Change `- [ ]` to `- [x]` for completed items

* Only check items that are relevant to your PR

* Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

Do not change the merge checklist in the pr template!
@pratx08 Revert it

@pratx08

pratx08 commented Jul 24, 2026

Copy link
Copy Markdown
Author

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.
Your PR will be reviewed once you have marked the appropriate checklist items.
To update the checklist:

* Change `- [ ]` to `- [x]` for completed items

* Only check items that are relevant to your PR

* Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

Do not change the merge checklist in the pr template! @pratx08 Revert it

Hey @NikhilA8606 , have addressed the change.

Comment thread src/pages/Appointments/AppointmentsPage.tsx Outdated
Comment thread src/pages/Appointments/AppointmentsPage.tsx Outdated

@nihal467 nihal467 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • can you add the video of the bug and what was resolved

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.

Appointment slots query cache key omits resource type/id

4 participants