fix: stabilize frontend e2e selectors and auth/session reliability (#373)
This commit is contained in:
@@ -157,7 +157,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
log.warn("[Auth] Session refresh failed, clearing local user state", { correlationId });
|
||||
log.debug("[Auth] Session refresh unavailable, clearing local user state", { correlationId });
|
||||
setUser(null);
|
||||
} else {
|
||||
log.warn("[Auth] Unexpected /auth/me response", { status: res.status, correlationId });
|
||||
@@ -181,7 +181,11 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
);
|
||||
const res = await fetch("/api/auth/refresh", init);
|
||||
if (!res.ok) {
|
||||
log.warn("[Auth] Token refresh rejected", { status: res.status, correlationId });
|
||||
if (res.status === 401) {
|
||||
log.debug("[Auth] Token refresh rejected (unauthenticated)", { status: res.status, correlationId });
|
||||
} else {
|
||||
log.warn("[Auth] Token refresh rejected", { status: res.status, correlationId });
|
||||
}
|
||||
}
|
||||
return res.ok;
|
||||
} catch (error) {
|
||||
|
||||
@@ -715,9 +715,7 @@ export function MobileEditModal({
|
||||
<div className="stock-total-field">
|
||||
<p className="sub">
|
||||
<strong>{totalLabel}:</strong> {deriveTotalFromForm(form)}
|
||||
{form.packageType !== "tube" && form.packageType !== "liquid_container"
|
||||
? ` ${deriveTotalFromForm(form) === 1 ? t("common.pill") : t("common.pills")}`
|
||||
: ""}
|
||||
{` ${deriveTotalFromForm(form) === 1 ? t("common.pill") : t("common.pills")}`}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -423,7 +423,12 @@ export function SharedSchedule() {
|
||||
// Use intakes (with per-intake takenBy) if available, fallback to blisters (legacy)
|
||||
const intakes =
|
||||
med.intakes ||
|
||||
med.blisters.map((b) => ({ ...b, takenBy: null as string | null, intakeRemindersEnabled: false }));
|
||||
med.blisters.map((b) => ({
|
||||
...b,
|
||||
intakeUnit: null,
|
||||
takenBy: null as string | null,
|
||||
intakeRemindersEnabled: false,
|
||||
}));
|
||||
|
||||
intakes.forEach((intake, intakeIdx) => {
|
||||
// Filter: only include intakes for this person (null = everyone, or matches share's takenBy)
|
||||
@@ -535,7 +540,14 @@ export function SharedSchedule() {
|
||||
const depletion: Record<string, number | null> = {};
|
||||
|
||||
for (const med of data.medications) {
|
||||
const intakes = med.intakes || med.blisters.map((b) => ({ ...b, takenBy: null as string | null }));
|
||||
const intakes =
|
||||
med.intakes ||
|
||||
med.blisters.map((b) => ({
|
||||
...b,
|
||||
intakeUnit: null,
|
||||
takenBy: null as string | null,
|
||||
intakeRemindersEnabled: false,
|
||||
}));
|
||||
|
||||
// Count unique people from all intakes (for per-intake takenBy)
|
||||
const uniquePeople = new Set<string>();
|
||||
|
||||
Reference in New Issue
Block a user