This repository was archived by the owner on May 29, 2023. It is now read-only.

Description
I am experiencing connection issues when the API client is invoked before Actual has started.
The problem occurs when doing the following
- Try to connect to the API before Actual has started
- Start Actual
- Retry the connection
- The connection is never established
I have not investigated further, but I think this line might be a problem
Maybe an unsuccessful connection attempt returns something that evaluates as truthy?
I am not sure if this is the best solution, but applying this patch fixes the problem
--- a/node_modules/@actual-app/api/connection.js
+++ b/node_modules/@actual-app/api/connection.js
@@ -41,6 +41,7 @@ async function init(socketName) {
// TODO: This could spawn Actual automatically. The ideal solution
// would be to bundle the entire backend and embed it directly
// into the distributed library.
+ initialized = false;
throw new Error("Couldn't connect to Actual. Please run the app first.");
}