Solve 1 bug more
This commit is contained in:
26
sigpro2.js
26
sigpro2.js
@@ -325,7 +325,10 @@ const Render = renderFn => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
processResult(renderFn({ onCleanup: fn => cleanups.add(fn) }))
|
processResult(renderFn({ onCleanup: fn => cleanups.add(fn) }))
|
||||||
} finally { activeOwner = previousOwner }
|
} finally {
|
||||||
|
activeOwner = previousOwner
|
||||||
|
activeEffect = previousEffect
|
||||||
|
}
|
||||||
|
|
||||||
mounts.forEach(fn => fn())
|
mounts.forEach(fn => fn())
|
||||||
return {
|
return {
|
||||||
@@ -455,16 +458,19 @@ const Mount = (comp, target) => {
|
|||||||
|
|
||||||
const set = (signal, path, value) => {
|
const set = (signal, path, value) => {
|
||||||
if (value === undefined) {
|
if (value === undefined) {
|
||||||
signal(isFunc(path) ? path(signal()) : path);
|
signal(isFunc(path) ? path(signal()) : path)
|
||||||
} else {
|
return
|
||||||
const keys = path.split('.');
|
}
|
||||||
const last = keys.pop();
|
const keys = path.split('.')
|
||||||
const current = signal();
|
const last = keys.pop()
|
||||||
const obj = keys.reduce((o, k) => ({ ...o, [k]: { ...o[k] } }), { ...current });
|
const current = signal()
|
||||||
obj[last] = value;
|
const root = { ...current }
|
||||||
signal(obj);
|
let acc = root
|
||||||
|
for (const k of keys) acc = acc[k] = { ...acc[k] }
|
||||||
|
acc[last] = value
|
||||||
|
|
||||||
|
signal(root)
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
const SigPro = Object.freeze({ $, Watch, Tag, Render, If, For, Router, Mount, onMount, onUnmount, set })
|
const SigPro = Object.freeze({ $, Watch, Tag, Render, If, For, Router, Mount, onMount, onUnmount, set })
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user