Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3438 +/- ##
=======================================
Coverage 29.65% 29.65%
=======================================
Files 19 19
Lines 725 725
Branches 101 101
=======================================
Hits 215 215
Misses 459 459
Partials 51 51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces SWR as a dependency and adds a new SWR-based hook for fetching the emails list, aligning the web client’s data fetching with a cache/revalidation pattern.
Changes:
- Added
swrto the web app dependencies. - Refactored email list query param building into a shared helper.
- Introduced
useEmails(SWR-powered) alongside the existinglistEmailsfetch function.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
web/src/services/emails.ts |
Adds SWR hook for listing emails and factors query param generation into a helper. |
web/package.json |
Adds swr dependency. |
web/package-lock.json |
Locks SWR and related transitive dependencies. |
Files not reviewed (1)
- web/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
This PR introduces SWR as a dependency and begins adding an SWR-based hook for fetching paginated email lists, alongside a small refactor in the email root page’s state initialization.
Changes:
- Added
swrtowebdependencies (and lockfile updates). - Refactored
listEmailsto use a shared query-param builder and introduced a newuseEmailsSWR hook wrapper. - Minor reordering of
year/monthstate initialization inEmailRoot.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| web/src/services/emails.ts | Adds SWR hook (useEmails) and refactors query param construction for listEmails. |
| web/src/pages/EmailRoot.tsx | Moves year/month initialization earlier in the component. |
| web/package.json | Adds swr dependency. |
| web/package-lock.json | Locks swr and related dependency graph changes. |
Files not reviewed (1)
- web/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
web/src/services/emails.ts:95
- Because
listEmailsalways callsresponse.json()without checkingresponse.ok, HTTP 4xx/5xx responses won’t be surfaced as SWRerror(and may fail later with a shape mismatch). Consider throwing on non-OK responses (and/or returning a typed error payload) souseEmailscan reliably enter the'error'loadingState.
const params = generateListEmailsParamString(props)
const response = await fetch('/web/emails?' + params, {
method: 'GET'
})
return response.json() as Promise<ListEmailsResponse>
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This reverts commit ac5c0b1.
No description provided.