mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
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:
@@ -249,6 +249,10 @@ export const useFurniEditor = () =>
|
|||||||
const updateFurnidata = useCallback((id: number, name: string, description: string) =>
|
const updateFurnidata = useCallback((id: number, name: string, description: string) =>
|
||||||
{
|
{
|
||||||
pendingActionRef.current = { action: 'update', itemId: id };
|
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);
|
setLoading(true);
|
||||||
SendMessageComposer(new FurniEditorUpdateFurnidataComposer(id, JSON.stringify({ name, description })));
|
SendMessageComposer(new FurniEditorUpdateFurnidataComposer(id, JSON.stringify({ name, description })));
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
Reference in New Issue
Block a user