Skip to content

A local-first personal finance app

[AI] Fix stuck update button and useless [object Object] fatal error details (#8718)

Matiss Janis Aboltins43875b09fab4
diff --git a/packages/desktop-client/src/browser-preload.js b/packages/desktop-client/src/browser-preload.js
index 66905da0c7..03afae4f28 100644
--- a/packages/desktop-client/src/browser-preload.js
+++ b/packages/desktop-client/src/browser-preload.js
@@ -245,9 +245,11 @@ global.Actual = {
applyAppUpdate: async () => {
updateSW();
- // Wait for the app to reload
+ // Wait for the service worker swap to reload the page. If the new worker
+ // never takes control (e.g. the server is mid-update), force a reload so
+ // the "Update now" button doesn't hang forever with no feedback.
await new Promise(() => {
- // Do nothing
+ setTimeout(() => window.location.reload(), 15000);
});
},
diff --git a/packages/desktop-client/src/components/FatalError.test.tsx b/packages/desktop-client/src/components/FatalError.test.tsx
index a7f3107b3a..56f49ccf09 100644
--- a/packages/desktop-client/src/components/FatalError.test.tsx
+++ b/packages/desktop-client/src/components/FatalError.test.tsx
@@ -1,5 +1,6 @@
import { LazyLoadFailedError } from '@actual-app/core/shared/errors';
import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { describe, expect, it } from 'vitest';
import { TestProviders } from '#mocks';
@@ -53,6 +54,20 @@ describe('FatalError', () => {
).toBeInTheDocument();
});
+ it('shows the raw payload fields in the error details, not "[object Object]"', async () => {
+ const error = {
+ type: 'app-init-failure',
+ BackendInitFailure: true,
+ };
+
+ render(<FatalError error={error} />, { wrapper: TestProviders });
+
+ await userEvent.click(screen.getByText('Show Error'));
+
+ expect(screen.getByText(/BackendInitFailure/)).toBeInTheDocument();
+ expect(screen.queryByText(/\[object Object\]/)).not.toBeInTheDocument();
+ });
+
it('renders the UI error message for a generic Error', () => {
render(<FatalError error={new Error('boom')} />, {
wrapper: TestProviders,
diff --git a/packages/desktop-client/src/components/FatalError.tsx b/packages/desktop-client/src/components/FatalError.tsx
index 5d741a4752..a68ea7f187 100644
--- a/packages/desktop-client/src/components/FatalError.tsx
+++ b/packages/desktop-client/src/components/FatalError.tsx
@@ -203,7 +203,10 @@ export function FatalError({ error: rawError }: FatalErrorProps) {
rawError instanceof Error
? rawError
: rawError && typeof rawError === 'object'
- ? Object.assign(new Error(String(rawError)), rawError)
+ ? // Plain message objects (e.g. app-init-failure payloads) stringify
+ // to "[object Object]" — keep the real fields so bug reports carry
+ // the actual cause.
+ Object.assign(new Error(JSON.stringify(rawError)), rawError)
: new Error(String(rawError));
const showSimpleRender = 'type' in error && error.type === 'app-init-failure';
const isLazyLoadError = error instanceof LazyLoadFailedError;
diff --git a/upcoming-release-notes/fix-stuck-update-button-and-error-details.md b/upcoming-release-notes/fix-stuck-update-button-and-error-details.md
new file mode 100644
index 0000000000..81f1b3441c
--- /dev/null
+++ b/upcoming-release-notes/fix-stuck-update-button-and-error-details.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Fix the "Update now" button getting stuck doing nothing, and show useful details instead of "[object Object]" on the startup error screen