#Solid => Form + Table State Sync
13 messages · Page 1 of 1 (latest)
I've tried things like this:
const table = createSolidTable({
data: layersField().state.value,
columns,
getCoreRowModel: getCoreRowModel(),
});
Solid => Form + Table State Sync
My bad, table with Solid need a getter 🤦
const table = createSolidTable({
get data() {
return layersField().state.value;
},
columns,
getCoreRowModel: getCoreRowModel(),
});
I'm just curious: do you need the signal? Can't you use form.useStore((state) => state.values) like this:
const formValues = form.useStore((state) => state.values);
const table = createSolidTable({
get data() {
return formValues;
},
columns,
getCoreRowModel: getCoreRowModel(),
});
I think this work too, i'll try
Well, this isn't working. I suppose the table data needs to be reactive to trigger re-renders.
it should be by using the store…
// Not working
const table = createSolidTable({
get data() {
return form.useStore((state) => state.values.layers);
},
columns,
getCoreRowModel: getCoreRowModel(),
});
// Working
const table = createSolidTable({
get data() {
return form.useStore((state) => state.values.layers)();
},
columns,
getCoreRowModel: getCoreRowModel(),
});
// Not Working
const data = form.useStore((state) => state.values.layers);
const table = createSolidTable({
get data() {
return data();
},
columns,
getCoreRowModel: getCoreRowModel(),
});
// Not Working
const data = form.useStore((state) => state.values.layers);
const table = createSolidTable({
get data() {
return data;
},
columns,
getCoreRowModel: getCoreRowModel(),
});
It's a “problem” with the way reactivity is handled in Solid, isn't it? I'm not familiar with Solid, so I can't say for sure.
Probably 👍 I guess it'll work in React though
Yes probably
Thanks for trying it out 🙂