Skip to content

Commit c08977b

Browse files
Copilotna-trium-144
andcommitted
Fix mutex runExclusive to properly handle both Promise and non-Promise returns
Co-authored-by: na-trium-144 <100704180+na-trium-144@users.noreply.github.com>
1 parent 1f9008d commit c08977b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/terminal/wandbox/wandbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ export function WandboxProvider({ children }: { children: ReactNode }) {
9494
// Create a simple mutex that just executes the function immediately
9595
// Wandbox doesn't need mutex locking as it makes synchronous API calls
9696
const mutex: MutexInterface = {
97-
runExclusive: async <T,>(fn: () => Promise<T> | T) => fn(),
97+
runExclusive: async <T,>(fn: () => Promise<T> | T) => {
98+
const result = fn();
99+
return result instanceof Promise ? result : Promise.resolve(result);
100+
},
98101
acquire: async () => {
99102
return () => {}; // Release function (no-op)
100103
},

0 commit comments

Comments
 (0)