Skip to content

Commit

Permalink
fix #1998 Switch relying on order
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Jan 3, 2024
1 parent 8d2de12 commit 7e5667a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/neat-drinks-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix #1998 Switch relying on order
2 changes: 1 addition & 1 deletion packages/solid/src/render/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type EvalConditions = readonly [number, unknown?, MatchProps<unknown>?];
export function Switch(props: { fallback?: JSX.Element; children: JSX.Element }): JSX.Element {
let keyed = false;
const equals: MemoOptions<EvalConditions>["equals"] = (a, b) =>
a[0] === b[0] && (keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
(keyed ? a[1] === b[1] : !a[1] === !b[1]) && a[2] === b[2];
const conditions = children(() => props.children) as unknown as () => MatchProps<unknown>[],
evalConditions = createMemo(
(): EvalConditions => {
Expand Down

0 comments on commit 7e5667a

Please sign in to comment.