fix: Uebertrag buchen tat sichtbar nichts – useToast falsch ausgepackt
useToast() liefert die Melde-Funktion selbst, kein Objekt. In drei Dateien aus
dieser Sitzung stand "const { toast } = useToast()", also undefined. Der Aufruf
steht fast immer in einem catch – dort verschluckt der TypeError die
eigentliche Meldung, und nach aussen passiert gar nichts.
Das erklaert beide Beschwerden:
- "Als Uebertrag buchen" schien wirkungslos: Die Buchung lief durch, dann warf
toast(), der catch warf beim Melden erneut, der Dialog blieb offen.
- "Braucht ein Reload": Im Eingang stand toast() VOR laden() – der Dialog
schloss noch, das Neuladen kam nie. Die Cache-Kopfzeile, die ich dafuer
gesetzt habe, war nicht die Ursache; richtig ist sie trotzdem.
Am Ende in der laufenden Oberflaeche nachgeklickt: Dialog schliesst, Meldung
erscheint, die Zeile wird ohne Neuladen zum Uebertrag, die Gegenseite liegt auf
dem Zielkonto, beide Salden stimmen.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,7 @@ export default function UebertragDialog({
|
|||||||
vorgang, accounts, accountById, baseCurrency, onClose, onFertig,
|
vorgang, accounts, accountById, baseCurrency, onClose, onFertig,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { toast } = useToast();
|
const toast = useToast();
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
const [ziel, setZiel] = useState("");
|
const [ziel, setZiel] = useState("");
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { formatDate } from "../format";
|
|||||||
// Deshalb ist auch eine falsche Verknüpfung folgenlos: Lösen stellt alles her.
|
// Deshalb ist auch eine falsche Verknüpfung folgenlos: Lösen stellt alles her.
|
||||||
export default function Uebertragsvorschlaege({ baseCurrency, onChange }) {
|
export default function Uebertragsvorschlaege({ baseCurrency, onChange }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { toast } = useToast();
|
const toast = useToast();
|
||||||
|
|
||||||
const [stand, setStand] = useState(null); // { verknuepft, vorschlaege }
|
const [stand, setStand] = useState(null); // { verknuepft, vorschlaege }
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import { formatDate } from "../format";
|
|||||||
// Zahlung nicht ein zweites Mal verbucht wird.
|
// Zahlung nicht ein zweites Mal verbucht wird.
|
||||||
export default function Eingang() {
|
export default function Eingang() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { toast } = useToast();
|
const toast = useToast();
|
||||||
const confirm = useConfirm();
|
const confirm = useConfirm();
|
||||||
const { baseCurrency } = useSettings();
|
const { baseCurrency } = useSettings();
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,10 @@ export function ToastProvider({ children }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Liefert die Melde-Funktion SELBST, nicht ein Objekt mit ihr darin.
|
||||||
|
// `const { toast } = useToast()` ergibt undefined – und weil der Aufruf fast
|
||||||
|
// immer in einem catch steht, verschluckt der TypeError dort die eigentliche
|
||||||
|
// Meldung und es passiert sichtbar gar nichts.
|
||||||
export function useToast() {
|
export function useToast() {
|
||||||
return useContext(ToastContext);
|
return useContext(ToastContext);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user