Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

refactor: silence double-toast custom-catch sites in meatspace health forms (#2669)

[._.]/ Adam Eivy36d174fe9b98
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3a4be9ff1e..f4c9496be2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -20,6 +20,8 @@
## Changed
+- [issue-2669] **MeatSpace health forms no longer double-toast on failure.** Saving a genome marker note, or adding/editing a custom drink or custom nicotine product, showed two stacked error toasts when the request failed — once from the API helper and once from the form's own catch. These five sites now suppress the helper toast so a single error is shown.
+
- **Clicking a Creative Commission now opens its own page showing every render it has made.** A commission used to open a sidebar edit form; it now navigates to a routed detail page (`/creative-commission/:id`) that leads with a gallery of every render the commission has produced — each run's final video (with an inline play badge), rendered scene, or produced image, newest first — above the full editable brief/schedule/generation config. Rate a render 👍/👎 and add a note right on its card to steer the next run, run the commission now, pause it, or delete it from the header. The render, its Creative Director output, and the open commission are all directly shareable and bookmarkable (the URL is the source of truth), and a notification about a scheduled run deep-links straight to the render. Creating a new commission still uses the quick "New Commission" drawer on the index; a run whose project was pruned degrades to a status-only card with its output link intact.
- [issue-2702] **The Creative Director now shows you what it made.** Project cards on `/creative-director` lead with a preview of the produced media — the final video's poster with a play badge (click the artwork to open the project, the badge to play it inline), a rendered scene, or a produced image from a directive plan — falling back to a tidy "no render yet" placeholder instead of a wall of text. The Overview tab renders the final cut inline instead of showing only a job id, keeping the Media History link alongside it; plans that emit images show the image. Previews respect each project's aspect ratio (16:9 / 9:16 / 1:1), and the grid never downloads a video until you actually press play.
diff --git a/client/src/components/meatspace/tabs/AlcoholTab.jsx b/client/src/components/meatspace/tabs/AlcoholTab.jsx
index 71db03004b..d30d0ea564 100644
--- a/client/src/components/meatspace/tabs/AlcoholTab.jsx
+++ b/client/src/components/meatspace/tabs/AlcoholTab.jsx
@@ -202,7 +202,7 @@ export default function AlcoholTab() {
if (error) { toast.error(error); return; }
const parsedOz = Math.round(toOz(parseFloat(buttonForm.oz), buttonVolumeUnit) * 100) / 100;
const parsedAbv = parseFloat(buttonForm.abv);
- const result = await api.addCustomDrink({ name: buttonForm.name, oz: parsedOz, abv: parsedAbv }).catch(() => null);
+ const result = await api.addCustomDrink({ name: buttonForm.name, oz: parsedOz, abv: parsedAbv }, { silent: true }).catch(() => null);
if (!result) { toast.error('Failed to add drink button'); return; }
setButtonForm({ name: '', oz: '', abv: '' });
setButtonVolumeUnit('oz');
@@ -222,7 +222,7 @@ export default function AlcoholTab() {
if (error) { toast.error(error); return; }
const parsedOz = Math.round(toOz(parseFloat(buttonForm.oz), buttonVolumeUnit) * 100) / 100;
const parsedAbv = parseFloat(buttonForm.abv);
- const result = await api.updateCustomDrink(editingButtonIdx, { name: buttonForm.name, oz: parsedOz, abv: parsedAbv }).catch(() => null);
+ const result = await api.updateCustomDrink(editingButtonIdx, { name: buttonForm.name, oz: parsedOz, abv: parsedAbv }, { silent: true }).catch(() => null);
if (!result) { toast.error('Failed to update drink button'); return; }
setEditingButtonIdx(null);
setButtonForm({ name: '', oz: '', abv: '' });
diff --git a/client/src/components/meatspace/tabs/GenomeTab.jsx b/client/src/components/meatspace/tabs/GenomeTab.jsx
index f5a9608826..4d40b6651f 100644
--- a/client/src/components/meatspace/tabs/GenomeTab.jsx
+++ b/client/src/components/meatspace/tabs/GenomeTab.jsx
@@ -184,7 +184,7 @@ export default function GenomeTab() {
}
notesTimerRef.current[markerId] = setTimeout(async () => {
setSavingNotes(markerId);
- await api.updateGenomeMarkerNotes(markerId, notes).catch(() => {
+ await api.updateGenomeMarkerNotes(markerId, notes, { silent: true }).catch(() => {
toast.error('Failed to save notes');
});
setSavingNotes(null);
diff --git a/client/src/components/meatspace/tabs/NicotineTab.jsx b/client/src/components/meatspace/tabs/NicotineTab.jsx
index 2546f9c138..2bc2cef1cc 100644
--- a/client/src/components/meatspace/tabs/NicotineTab.jsx
+++ b/client/src/components/meatspace/tabs/NicotineTab.jsx
@@ -155,7 +155,7 @@ export default function NicotineTab() {
e.preventDefault();
const error = validateProductButton(buttonForm);
if (error) { toast.error(error); return; }
- const result = await api.addCustomNicotineProduct({ name: buttonForm.name, mgPerUnit: parseFloat(buttonForm.mgPerUnit) }).catch(() => null);
+ const result = await api.addCustomNicotineProduct({ name: buttonForm.name, mgPerUnit: parseFloat(buttonForm.mgPerUnit) }, { silent: true }).catch(() => null);
if (!result) { toast.error('Failed to add product button'); return; }
setButtonForm({ name: '', mgPerUnit: '' });
fetchProductButtons();
@@ -171,7 +171,7 @@ export default function NicotineTab() {
if (editingButtonIdx === null) return;
const error = validateProductButton(buttonForm);
if (error) { toast.error(error); return; }
- const result = await api.updateCustomNicotineProduct(editingButtonIdx, { name: buttonForm.name, mgPerUnit: parseFloat(buttonForm.mgPerUnit) }).catch(() => null);
+ const result = await api.updateCustomNicotineProduct(editingButtonIdx, { name: buttonForm.name, mgPerUnit: parseFloat(buttonForm.mgPerUnit) }, { silent: true }).catch(() => null);
if (!result) { toast.error('Failed to update product button'); return; }
setEditingButtonIdx(null);
setButtonForm({ name: '', mgPerUnit: '' });
diff --git a/client/src/services/apiMeatspace.js b/client/src/services/apiMeatspace.js
index e8efc7cd99..32e57ff3b6 100644
--- a/client/src/services/apiMeatspace.js
+++ b/client/src/services/apiMeatspace.js
@@ -15,9 +15,10 @@ export const saveGenomeMarker = (data) => request('/meatspace/genome/markers', {
method: 'POST',
body: JSON.stringify(data)
});
-export const updateGenomeMarkerNotes = (id, notes) => request(`/meatspace/genome/markers/${id}/notes`, {
+export const updateGenomeMarkerNotes = (id, notes, options = {}) => request(`/meatspace/genome/markers/${id}/notes`, {
method: 'PUT',
- body: JSON.stringify({ notes })
+ body: JSON.stringify({ notes }),
+ ...options
});
export const deleteGenomeMarker = (id) => request(`/meatspace/genome/markers/${id}`, { method: 'DELETE' });
export const deleteGenomeData = () => request('/meatspace/genome', { method: 'DELETE' });
@@ -88,13 +89,15 @@ export const removeAlcoholDrink = (date, index) => request(`/meatspace/alcohol/l
method: 'DELETE'
});
export const getCustomDrinks = () => request('/meatspace/alcohol/custom-drinks');
-export const addCustomDrink = (data) => request('/meatspace/alcohol/custom-drinks', {
+export const addCustomDrink = (data, options = {}) => request('/meatspace/alcohol/custom-drinks', {
method: 'POST',
- body: JSON.stringify(data)
+ body: JSON.stringify(data),
+ ...options
});
-export const updateCustomDrink = (index, data) => request(`/meatspace/alcohol/custom-drinks/${index}`, {
+export const updateCustomDrink = (index, data, options = {}) => request(`/meatspace/alcohol/custom-drinks/${index}`, {
method: 'PUT',
- body: JSON.stringify(data)
+ body: JSON.stringify(data),
+ ...options
});
export const removeCustomDrink = (index) => request(`/meatspace/alcohol/custom-drinks/${index}`, {
method: 'DELETE'
@@ -118,13 +121,15 @@ export const removeNicotineEntry = (date, index) => request(`/meatspace/nicotine
method: 'DELETE'
});
export const getCustomNicotineProducts = () => request('/meatspace/nicotine/custom-products');
-export const addCustomNicotineProduct = (data) => request('/meatspace/nicotine/custom-products', {
+export const addCustomNicotineProduct = (data, options = {}) => request('/meatspace/nicotine/custom-products', {
method: 'POST',
- body: JSON.stringify(data)
+ body: JSON.stringify(data),
+ ...options
});
-export const updateCustomNicotineProduct = (index, data) => request(`/meatspace/nicotine/custom-products/${index}`, {
+export const updateCustomNicotineProduct = (index, data, options = {}) => request(`/meatspace/nicotine/custom-products/${index}`, {
method: 'PUT',
- body: JSON.stringify(data)
+ body: JSON.stringify(data),
+ ...options
});
export const removeCustomNicotineProduct = (index) => request(`/meatspace/nicotine/custom-products/${index}`, {
method: 'DELETE'
diff --git a/client/src/services/apiMeatspace.test.js b/client/src/services/apiMeatspace.test.js
new file mode 100644
index 0000000000..99c6114ff1
--- /dev/null
+++ b/client/src/services/apiMeatspace.test.js
@@ -0,0 +1,84 @@
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+
+vi.mock('./apiCore.js', () => ({
+ request: vi.fn(),
+}));
+
+let request;
+let updateGenomeMarkerNotes;
+let addCustomDrink;
+let updateCustomDrink;
+let addCustomNicotineProduct;
+let updateCustomNicotineProduct;
+
+beforeEach(async () => {
+ vi.resetModules();
+ ({ request } = await import('./apiCore.js'));
+ ({
+ updateGenomeMarkerNotes,
+ addCustomDrink,
+ updateCustomDrink,
+ addCustomNicotineProduct,
+ updateCustomNicotineProduct,
+ } = await import('./apiMeatspace.js'));
+ request.mockReset();
+ request.mockResolvedValue({});
+});
+
+// GenomeTab/NicotineTab/AlcoholTab all own their own failure toast (an inline
+// `.catch` toast, or an `if (!result) toast.error(...)` after a swallowing
+// catch). Without a way to suppress request()'s default toast, each failure
+// reports twice — these wrappers must forward a trailing `options` (issue #2669).
+describe('apiMeatspace double-toast wrappers forward options', () => {
+ it('updateGenomeMarkerNotes forwards silent and keeps the PUT body', async () => {
+ await updateGenomeMarkerNotes('m1', 'note text', { silent: true });
+ const [path, options] = request.mock.calls[0];
+ expect(path).toBe('/meatspace/genome/markers/m1/notes');
+ expect(options.silent).toBe(true);
+ expect(options.method).toBe('PUT');
+ expect(JSON.parse(options.body)).toEqual({ notes: 'note text' });
+ });
+
+ it('addCustomDrink forwards silent and keeps the POST body', async () => {
+ await addCustomDrink({ name: 'Lager', oz: 12, abv: 5 }, { silent: true });
+ const [path, options] = request.mock.calls[0];
+ expect(path).toBe('/meatspace/alcohol/custom-drinks');
+ expect(options.silent).toBe(true);
+ expect(options.method).toBe('POST');
+ expect(JSON.parse(options.body)).toEqual({ name: 'Lager', oz: 12, abv: 5 });
+ });
+
+ it('updateCustomDrink forwards silent and keeps the PUT body + indexed path', async () => {
+ await updateCustomDrink(2, { name: 'IPA', oz: 16, abv: 7 }, { silent: true });
+ const [path, options] = request.mock.calls[0];
+ expect(path).toBe('/meatspace/alcohol/custom-drinks/2');
+ expect(options.silent).toBe(true);
+ expect(options.method).toBe('PUT');
+ expect(JSON.parse(options.body)).toEqual({ name: 'IPA', oz: 16, abv: 7 });
+ });
+
+ it('addCustomNicotineProduct forwards silent and keeps the POST body', async () => {
+ await addCustomNicotineProduct({ name: 'Pouch', mgPerUnit: 6 }, { silent: true });
+ const [path, options] = request.mock.calls[0];
+ expect(path).toBe('/meatspace/nicotine/custom-products');
+ expect(options.silent).toBe(true);
+ expect(options.method).toBe('POST');
+ expect(JSON.parse(options.body)).toEqual({ name: 'Pouch', mgPerUnit: 6 });
+ });
+
+ it('updateCustomNicotineProduct forwards silent and keeps the PUT body + indexed path', async () => {
+ await updateCustomNicotineProduct(3, { name: 'Gum', mgPerUnit: 4 }, { silent: true });
+ const [path, options] = request.mock.calls[0];
+ expect(path).toBe('/meatspace/nicotine/custom-products/3');
+ expect(options.silent).toBe(true);
+ expect(options.method).toBe('PUT');
+ expect(JSON.parse(options.body)).toEqual({ name: 'Gum', mgPerUnit: 4 });
+ });
+
+ it('stays callable without options (back-compat) and then toasts by default', async () => {
+ await addCustomDrink({ name: 'Stout', oz: 12, abv: 6 });
+ const [, options] = request.mock.calls[0];
+ expect(options.silent).toBeUndefined();
+ expect(options.method).toBe('POST');
+ });
+});