mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
Merge remote-tracking branch 'origin/main' into fix/v1397-tz
This commit is contained in:
commit
ada490c7e9
57 files changed
+1485
-99
No files matched your search
@@ -63,6 +63,10 @@ import {
|
||||
import { dayOfLocalInput, useLinkedDayContext } from "./use-linked-day-context";
|
||||
import { MoodQuickTags } from "./mood-quick-tags";
|
||||
import { useRecentTags } from "./recent-tags";
|
||||
import {
|
||||
droppedAnyLinkKeys,
|
||||
type DroppedLinkKeysWire,
|
||||
} from "@/lib/mood/dropped-link-keys";
|
||||
import { moodFaceIcon } from "./mood-tag-icons";
|
||||
// One catalogue for the chip strip and for every server-side reader of what it
|
||||
// writes. Split apart, the write side gained a locale and the read side did
|
||||
@@ -219,7 +223,7 @@ export function MoodForm({ onSuccess, onCancel, footerSlot }: MoodFormProps) {
|
||||
|
||||
const trimmedNote = note.trim();
|
||||
|
||||
await apiPost("/api/mood-entries", {
|
||||
const saved = await apiPost<DroppedLinkKeysWire>("/api/mood-entries", {
|
||||
mood,
|
||||
tags: tags.length > 0 ? tags : undefined,
|
||||
tagKeys: tagKeys.length > 0 ? tagKeys : undefined,
|
||||
@@ -243,6 +247,9 @@ export function MoodForm({ onSuccess, onCancel, footerSlot }: MoodFormProps) {
|
||||
await invalidateKeys(queryClient, moodDependentKeys);
|
||||
await refetchInactiveDailyReads(queryClient);
|
||||
toast.success(t("common.saved"));
|
||||
// The entry landed, but a tag picked here may have been archived or
|
||||
// deleted elsewhere since the picker loaded; the server says so.
|
||||
if (droppedAnyLinkKeys(saved)) toast.warning(t("mood.tagsNotSaved"));
|
||||
onSuccess?.();
|
||||
} catch (err) {
|
||||
setError(localizedApiError(err, t, "mood.saveError"));
|
||||
|
||||
@@ -112,6 +112,10 @@ import { dayOfLocalInput, useLinkedDayContext } from "./use-linked-day-context";
|
||||
import { apiDelete, apiGet, apiPost, apiPut } from "@/lib/api/api-fetch";
|
||||
import { MOOD_LIST_PAGE_SIZE as PAGE_SIZE } from "@/lib/mood/list-page-size";
|
||||
import { localizedApiError } from "@/lib/api/localized-error";
|
||||
import {
|
||||
droppedAnyLinkKeys,
|
||||
type DroppedLinkKeysWire,
|
||||
} from "@/lib/mood/dropped-link-keys";
|
||||
|
||||
// Re-export the score map under the legacy local name to keep the
|
||||
// rest of this file unchanged. v1.4.27 B6 / BL-P6-11 — the single
|
||||
@@ -471,7 +475,7 @@ export function MoodList({ onAddFirst }: MoodListProps = {}) {
|
||||
note: string | null;
|
||||
moodLoggedAt: string;
|
||||
}) => {
|
||||
await apiPut(`/api/mood-entries/${id}`, {
|
||||
return apiPut<DroppedLinkKeysWire>(`/api/mood-entries/${id}`, {
|
||||
mood,
|
||||
tags,
|
||||
tagKeys,
|
||||
@@ -488,7 +492,10 @@ export function MoodList({ onAddFirst }: MoodListProps = {}) {
|
||||
moodLoggedAt,
|
||||
});
|
||||
},
|
||||
onSuccess: async () => {
|
||||
onSuccess: async (saved) => {
|
||||
// A tag picked in the dialog may have been archived or deleted
|
||||
// elsewhere since it opened; the server names what it did not store.
|
||||
if (droppedAnyLinkKeys(saved)) toast.warning(t("mood.tagsNotSaved"));
|
||||
await invalidateKeys(queryClient, moodDependentKeys);
|
||||
await refetchInactiveDailyReads(queryClient);
|
||||
setEditSeed({
|
||||
|
||||
Reference in new issue
Block a user