Repository navigation
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
object-storage-management-web | 8efda28 | Commit Preview URL Branch Preview URL |
Dec 01 2026, 01:43 PM |
| const [notFound, setNotFound] = useState(false); | ||
| // The partners table passes the row in router state, which saves the partner request. It is read once | ||
| // here because the effect below clears it, and StrictMode's second effect run must still see it. | ||
| const [statePartner] = useState(() => (location.state as { partner?: WholesalerPartnerDetail } | null)?.partner); |
There was a problem hiding this comment.
Now that GET /partners/:id exists, why keep the router state at all? It saves one cheap request that runs in parallel with the usage one anyway, and it costs the state-clearing effect, the useState snapshot for StrictMode, the known branch in loadWholesalerPartner and a row that can be stale. Always fetching would remove all of that, and the table wouldn't need to pass state either.
|
|
||
| // When the partner can't be loaded the usage request fails for the same reason, so only the partner error counts. | ||
| if (partner.status === 'rejected') { | ||
| if (NOT_FOUND_STATUSES.includes(partner.reason?.response?.status)) return { kind: 'notFound' }; |
There was a problem hiding this comment.
There's already hasApiErrorStatus in utils/apiError, use it instead of reading reason.response.status by hand.
There was a problem hiding this comment.
fixed, also added a lint rule which I read somewhere was a the best way to stop repeated mistakes by agents. we can give it a try. I also added eslint-suppressions to ignore places in the codebase already using this anti pattern, we should refactor those later
…d syntax rules - Introduced eslint-suppressions.json to manage specific ESLint rule suppressions across various files. - Updated eslint.config.mjs to include new rules for handling restricted syntax in TypeScript files, ensuring better error handling for API responses.
What
The wholesaler partner detail page (
/wholesalers/partners/:id) now works when opened from a shared link, a new tab or a refresh, not only when navigating from the partners table.Why
The page read the partner only from the router state set by the partners table, and there was no endpoint to fetch a partner by id. Opening the URL directly showed the title "Partner" with no email, status or actions; only the usage cards loaded
How
wholesalersService.getPartner(id)calls the newGET /wholesalers/partners/:id(backend PR below).useWholesalerPartner.apiErrorMessage.