feat(furni-editor): optimistically reflect mirrored public_name on save

The server now mirrors the furnidata display name into
items_base.public_name, so on updateFurnidata patch selectedItem.publicName
immediately; the auto detail re-fetch that follows agrees with the DB
value (no flicker). Not applied to revertFurnidata (revert restores the
previous DB name).
This commit is contained in:
simoleo89
2026-06-06 14:03:59 +02:00
parent ca937aa8cd
commit 7384a12b92
+4
View File
@@ -249,6 +249,10 @@ export const useFurniEditor = () =>
const updateFurnidata = useCallback((id: number, name: string, description: string) =>
{
pendingActionRef.current = { action: 'update', itemId: id };
// Optimistic: the server now mirrors the furnidata display name into
// items_base.public_name, so reflect it immediately in the read-only
// "Public Name" field. The auto re-fetch that follows will agree (no flicker).
setSelectedItem(prev => (prev && prev.id === id ? { ...prev, publicName: name } : prev));
setLoading(true);
SendMessageComposer(new FurniEditorUpdateFurnidataComposer(id, JSON.stringify({ name, description })));
}, []);