• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

medplum / medplum / 30308366235
92%
main: 92%

Build:
Build:
LAST BUILD BRANCH: maddy/hg-profile
DEFAULT BRANCH: main
Ran 27 Jul 2026 09:54PM UTC
Jobs 1
Files 845
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Jul 2026 09:48PM UTC coverage: 91.977%. Remained the same
30308366235

push

github

web-flow
Extract useSchedulingResources hook (#9931)

* Extract useSchedulingResources hook

This encapsulates fetching the appointment/slot data, managing the state
and subscribing to events needed to keep it all in sync.

Implementation notes:
- To handle future multi-schedule UI, we make this hook take an array of
  Schedule resources instead of just one.

- Minor functional change: we're now fetching Appointment records
  related to any of the Schedule's actors, instead of assuming that the
  Schedule resource has exactly one actor and reading `schedule.actor[0]`.
  Medplum still recommends using one Actor per Schedule (our scheduling
  API endpoints like $book assume that this is the case), but our UI
  does not need to enforce that restriction to render components like
  calendar widgets.

- We emit one `Appointment` and one `Slot` query per input schedule.
  This means that each one can be cached independently in the
  MedplumClient query cache, and actions like selecting or unselecting a
  single Schedule for display don't need to re-fetch all the other
  Appointment/Slot resources that we have already loaded.

- We do some slightly awkward maneuvering around exhaustive-deps; we
  convert our input Schedule resources into stable strings to avoid
  re-fetching when unstable inputs are passed in. This makes the
  single-schedule use case (i.e. `useSchedulingResources([schedule],
  range)`) nice to consume without explicit memoization of that list.

Signed-off-by: Noah Silas <noah@medplum.com>

* Guard unstable range inputs

We think it's likely that some consumers will use this hook while
constructing these input objects every render; roughly like this:

```tsx
function MyComponent(props: { schedule: Schedule, start: Date }) {
  const range = { start, end: addDays(start, 7) };
  const { slots, loading } = useSchedulingSlots({
    schedules: [schedule],
    range: { start, end },
  });
  return (...);
}
```

Without some extra care, this kind of usage can... (continued)

22595 of 25670 branches covered (88.02%)

Branch coverage included in aggregate %.

40102 of 42496 relevant lines covered (94.37%)

12270.55 hits per line

Jobs
ID Job ID Ran Files Coverage
1 30308366235.1 27 Jul 2026 09:54PM UTC 845
91.98
GitHub Action Run
Source Files on build 30308366235
  • Tree
  • List 845
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #30308366235
  • 971bdb91 on github
  • Prev Build on main (#30307952705)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc