deepvora92
deepvora92
SSolidJS
Created by deepvora92 on 4/25/2024 in #support
Slow table paint/display
No description
6 replies
SSolidJS
Created by deepvora92 on 12/26/2023 in #support
Unable to mutate data created by createResource.
I have the following code that i'm trying to get to work but it doesnt update the node/ui
const [tb, { mutate }] = createResource(
() => [params.entityId, toDate()] as const,
([entityId, toDate]) => tbFetch(entityId, toDate),
);
// usage
<TreeView data={tb()!} mutate={mutate} />

<button
class={twclsx('ml-2')}
onClick={async () => {
const searchParams = new URLSearchParams({});
const tree = await apiPromise(
apiFetch(
`/entities/${params.entityId}/reports/master_balances/${props.item.id}?${searchParams.toString()}`,
{
credentials: 'include',
},
),
'Failed to fetch trial balance',
);

if (props.mutate) {
props.mutate!(() => {
props.item.children = flattenTree(tree);
return props.data;
});
}
}}
>
{props.item.name}
</button>
const [tb, { mutate }] = createResource(
() => [params.entityId, toDate()] as const,
([entityId, toDate]) => tbFetch(entityId, toDate),
);
// usage
<TreeView data={tb()!} mutate={mutate} />

<button
class={twclsx('ml-2')}
onClick={async () => {
const searchParams = new URLSearchParams({});
const tree = await apiPromise(
apiFetch(
`/entities/${params.entityId}/reports/master_balances/${props.item.id}?${searchParams.toString()}`,
{
credentials: 'include',
},
),
'Failed to fetch trial balance',
);

if (props.mutate) {
props.mutate!(() => {
props.item.children = flattenTree(tree);
return props.data;
});
}
}}
>
{props.item.name}
</button>
3 replies