Skip to content

Commit bb37548

Browse files
committed
fix: pathing issue in resolver
1 parent b52f653 commit bb37548

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

s/core/bindings/resolver.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Resolver<B extends Bindings> {
2020
const action = new Action()
2121
this.#update.subscribe(() => {
2222
action.value = this.#modes.has(mode)
23-
? this.#resolveAtom()(atom, mode as string)
23+
? this.#resolveAtom([])(atom, mode as string)
2424
: 0
2525
})
2626
return action
@@ -44,19 +44,22 @@ export class Resolver<B extends Bindings> {
4444
return lensAlgo(this.#now, state, value)
4545
}
4646

47-
#resolveAtom = (context: {path: string[]} = {path: []}) => (atom: Atom, zone: string | number): number => {
48-
context.path.push(`${zone}`)
49-
context.path.push(typeof atom === "string" ? atom : atom[0])
47+
#resolveAtom = (path: string[]) => (atom: Atom, zone: string | number): number => {
48+
const nextPath = [
49+
...path,
50+
String(zone),
51+
typeof atom === "string" ? atom : atom[0],
52+
]
5053

51-
const resolveAtom = this.#resolveAtom(context)
54+
const resolveAtom = this.#resolveAtom(nextPath)
5255

5356
if (typeof atom === "string")
54-
return this.#resolveCode(context.path, atom)
57+
return this.#resolveCode(nextPath, atom)
5558

5659
else switch (atom[0]) {
5760
case "code": {
5861
const [, code, settings] = atom
59-
return this.#resolveCode(context.path, code, settings)
62+
return this.#resolveCode(nextPath, code, settings)
6063
}
6164
case "and": {
6265
const [,...atoms] = atom

0 commit comments

Comments
 (0)