Skip to content

Commit

Permalink
fix: createSignal not found when bundled (#1964)
Browse files Browse the repository at this point in the history
* fix: createSignal not found when bundled

In some circumstances a global function export (like `createSignal`) can be transformed by rollup into a let binding, which will break the global evaluation of `transPending` since then `createSignal` will be defined after being used.

* move to a better place
  • Loading branch information
CrabNejonas authored Dec 1, 2023
1 parent e09a3cc commit 22667bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-coins-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix: createSignal not found when bundled
6 changes: 3 additions & 3 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ export const DevHooks: {
afterCreateSignal: null
};

// keep immediately evaluated module code, below its indirect declared let dependencies like Listener
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);

export type ComputationState = 0 | 1 | 2;

export interface SourceMapValue {
Expand Down Expand Up @@ -1075,6 +1072,9 @@ export function startTransition(fn: () => unknown): Promise<void> {
});
}

// keep immediately evaluated module code, below its dependencies like Listener & createSignal
const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);

export type Transition = [Accessor<boolean>, (fn: () => void) => Promise<void>];

/**
Expand Down

0 comments on commit 22667bb

Please sign in to comment.