mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-20 07:26:19 +00:00
Drop dead 'await success' on fire-and-forget catalog-admin actions
CatalogAdminContext exposes savePage / deletePage / saveOffer / createOffer / deleteOffer as void-returning fire-and-forget composer dispatches — they just call SendMessageComposer and let the server push back later. The Offer/Page edit views were 'await action(data); if(success) closeForm()' as if the actions returned Promise<boolean>, but they don't return anything. tsgo flagged the truthiness check on void. Drop the await + truthiness — call the action, then close the form unconditionally. This matches the actual behaviour: closeForm() ran synchronously after the void anyway. A future PR that wants real 'wait for server confirmation' UX should refactor the context to return Promise<boolean> (correlated to the response packet via the pendingActionRef machinery already in place).
This commit is contained in:
@@ -91,9 +91,10 @@ export const CatalogAdminOfferEditView: FC<{}> = () =>
|
||||
orderNumber
|
||||
};
|
||||
|
||||
const success = isNew ? await createOffer(data) : await saveOffer(data);
|
||||
if(isNew) createOffer(data);
|
||||
else saveOffer(data);
|
||||
|
||||
if(success && setEditingOffer) setEditingOffer(null);
|
||||
if(setEditingOffer) setEditingOffer(null);
|
||||
};
|
||||
|
||||
const handleDelete = () =>
|
||||
|
||||
Reference in New Issue
Block a user