Fix collapsible modifier sections not registering persistent
This commit is contained in:
parent
6323fa0879
commit
1a304ea425
1 changed files with 7 additions and 7 deletions
|
@ -258,7 +258,7 @@ export interface Section {
|
||||||
*/
|
*/
|
||||||
export function createCollapsibleModifierSections(
|
export function createCollapsibleModifierSections(
|
||||||
sectionsFunc: () => Section[]
|
sectionsFunc: () => Section[]
|
||||||
): [JSXFunction, Persistent<boolean>[]] {
|
): [JSXFunction, Persistent<Record<number, boolean>>] {
|
||||||
const sections: Section[] = [];
|
const sections: Section[] = [];
|
||||||
const processed:
|
const processed:
|
||||||
| {
|
| {
|
||||||
|
@ -279,9 +279,7 @@ export function createCollapsibleModifierSections(
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
const collapsed = createLazyProxy(() =>
|
const collapsed = persistent<Record<number, boolean>>({});
|
||||||
calculateSections().map(() => persistent<boolean>(false))
|
|
||||||
) as Persistent<boolean>[];
|
|
||||||
const jsxFunc = jsx(() => {
|
const jsxFunc = jsx(() => {
|
||||||
const sections = calculateSections();
|
const sections = calculateSections();
|
||||||
|
|
||||||
|
@ -289,10 +287,12 @@ export function createCollapsibleModifierSections(
|
||||||
if (unref(processed.visible[i]) === false) return null;
|
if (unref(processed.visible[i]) === false) return null;
|
||||||
const header = (
|
const header = (
|
||||||
<h3
|
<h3
|
||||||
onClick={() => (collapsed[i].value = !collapsed[i].value)}
|
onClick={() => (collapsed.value[i] = !collapsed.value[i])}
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
>
|
>
|
||||||
<span class={"modifier-toggle" + (unref(collapsed[i]) ? " collapsed" : "")}>
|
<span
|
||||||
|
class={"modifier-toggle" + (unref(collapsed.value[i]) ? " collapsed" : "")}
|
||||||
|
>
|
||||||
▼
|
▼
|
||||||
</span>
|
</span>
|
||||||
{s.title}
|
{s.title}
|
||||||
|
@ -300,7 +300,7 @@ export function createCollapsibleModifierSections(
|
||||||
</h3>
|
</h3>
|
||||||
);
|
);
|
||||||
|
|
||||||
const modifiers = unref(collapsed[i]) ? null : (
|
const modifiers = unref(collapsed.value[i]) ? null : (
|
||||||
<>
|
<>
|
||||||
<div class="modifier-container">
|
<div class="modifier-container">
|
||||||
<span class="modifier-amount">
|
<span class="modifier-amount">
|
||||||
|
|
Loading…
Reference in a new issue