Skip to content

Commit 60dea87

Browse files
author
AskPlays
committed
fix(desktop): preserve development OAuth registration
1 parent c9d03dd commit 60dea87

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎apps/desktop/src/app/DesktopClerk.test.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ const makeDesktopClerkLayer = (
8282
};
8383

8484
describe("DesktopClerk", () => {
85-
it.effect("uses the production scheme for unpackaged non-development runs", () => {
85+
it.effect.each([
86+
{ name: "non-development", isDevelopment: false },
87+
{ name: "development", isDevelopment: true },
88+
])("registers the app entry point only outside development ($name)", ({ isDevelopment }) => {
8689
storageMock.mockReturnValue(storageAdapter);
8790
createClerkBridgeMock.mockReturnValue({ cleanup: vi.fn(), isPrimaryInstance: true });
8891
const setAsDefaultProtocolClient = vi.fn(() => Effect.succeed(true));
@@ -97,11 +100,12 @@ describe("DesktopClerk", () => {
97100
const clerk = yield* DesktopClerk.DesktopClerk;
98101
yield* Effect.scoped(clerk.configure);
99102

100-
assert.deepEqual(setAsDefaultProtocolClient.mock.calls, [
101-
["t3code", process.execPath, ["/tmp/dist-electron/main.cjs"]],
102-
]);
103+
assert.deepEqual(
104+
setAsDefaultProtocolClient.mock.calls,
105+
isDevelopment ? [] : [["t3code", process.execPath, ["/tmp/dist-electron/main.cjs"]]],
106+
);
103107
}).pipe(
104-
Effect.provide(makeDesktopClerkLayer(false, [], "win32")),
108+
Effect.provide(makeDesktopClerkLayer(isDevelopment, [], "win32")),
105109
Effect.provideService(ElectronApp.ElectronApp, electronApp),
106110
Effect.provideService(ElectronWindow.ElectronWindow, electronWindow),
107111
);

‎apps/desktop/src/app/DesktopClerk.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,13 @@ export const make = Effect.gen(function* () {
143143
// records `"electron.exe" "%1"`, so a browser callback boots bare
144144
// Electron with the URL as the app path ("Unable to find Electron
145145
// app"). Re-register with the real entry point; the bridge already
146-
// ran, so this wins. Packaged builds and the mac dev launcher own
147-
// their registration.
148-
if (!environment.isPackaged && environment.platform === "win32") {
146+
// ran, so this wins. Development callbacks also need the dev server
147+
// environment, which this bare command cannot restore.
148+
if (
149+
!environment.isPackaged &&
150+
!environment.isDevelopment &&
151+
environment.platform === "win32"
152+
) {
149153
yield* electronApp.setAsDefaultProtocolClient(
150154
ElectronProtocol.getDesktopScheme(environment.isDevelopment),
151155
process.execPath,

0 commit comments

Comments
 (0)