binajmen
Explore posts from servers`classList` does not seem to apply the classes on render
Here a reduced reproduction of the issue:
https://playground.solidjs.com/anonymous/ba014c69-d95a-4e45-91cd-f95af6293f37
The issue:
present
should be underline. only when you click on past
then present
, then the classList is correctly applied
I suspect my Button
component should do something different regarding the class/classList
. I'm not sure what...
Any help would be greatly appreciated 🙏4 replies
is it ok to use `action()` to handle form submission in a SPA?
my idea is to handle form submission as follow:
but i'm wondering if there is a side effect i'm unaware of when in SPA mode 🤔
i believe actions were created for the SSR world, but perhaps i'm wrong and this usage is fine.
1 replies
How to set a new value in a store of `Record<string, __>`?
In the following example:
https://playground.solidjs.com/anonymous/07b233f7-59cb-4202-a3ca-595a497912f8
setValue("abc", 3)
on a blank object will trigger an error:
Probably because the internal of the Store's path syntax function is trying to access the data.
Am I suppose to use the Immer inspired produce
to add a new element to an object, or is there a syntax I don't know to use directly the setter from the store without using produce
?10 replies
Yet another reactivity problem :cry:
Hi,
This is a small reproduction of a problem I have with reactivity.
https://playground.solidjs.com/anonymous/ea30129e-e6d3-45aa-9345-192095a33f1b
My main question is why the DOM is not updated whereas I return from the context a getter function (that should trigger the reactivity, right?) while the data is correctly logged in the console
I based myself on this example:
https://github.com/solidjs/solid-realworld/blob/f6e77ecd652bf32f0dc9238f291313fd1af7e98b/src/store/index.js#L17-L31
12 replies
How do you delete an entry in an array when using `createStore`
In the following documentation, this case is not presented:
https://docs.solidjs.com/guides/complex-state-management
It could be trivial but I'm unsure of the right way for doing that 🙏
46 replies
Is this (completely 🫣) illegal in Solid world?
what is the best primitives/library to use when dealing with deep nested structure? the data I'm dealing with looks like a graph with nodes and leaves.
every nodes/leaves has a component that should update his data that should stay reactive.
pretty hard to explain the context 😅
I was thinking about using a createStore (globally or within a context)
23 replies
Is conditional rendering possible?
I have the following code:
getProgram
and postProgram
are wrappers around solid-query
.
When accessing the page with an id
in the query string (eg. ?id=123
) the first time, initialValues
equals to undefined
as the query is not yet finished and program.data
is undefined.
Then the query resolved and now program.data
is populated, but the form is already rendered so the form does not have any default values.
Hitting a second time the same page with the same id will lead to a populated form: the cache is already present so this time program.data
is defined.
Is it possiple to trigger a re-rendering à la React - (don't shoot me 🙈 ) - to rerun createForm with the actual data?
Or should I extract the createForm
+ <Form />
is a separate component and wrap it with a conditional <Show />
?22 replies
How do you keep reactivity?
I'm trying to organize my code but I lose the reactivity on the way...
When the
searchParams.id
value is set from undefined
to a correct string
value, I would expect the query to be executed and the effect to be triggered. It is not.
If I uncomment the createQuery
section instead of using getProgram
, it works.
11 replies
The props are reactive, right?
I've created a small wrapper around
solid-table
:
I use this component within a Suspense
. Therefore props.data is equal to []
, then populated with data. However, it doesn't seem to trigger an update. I tried to use a signal in the middle to make it reactive (see the comments) even if props.data
is already reactive. The effects are triggered and logging the data, but the table remains empty 🤔21 replies
Am I obliged to combine Suspense with Show?
I get the following error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'map')
I understand the cause, but I'm surprised. I was expecting that the Suspense
would delay the children until the data is available. Adding a Show
solves the issue, but I'm wondering if I can handle this differently.
22 replies
DTDrizzle Team
•Created by binajmen on 3/19/2024 in #help
Store percentage value as integer
Hi,
I realised once again how awesome Drizzle is! I want to store percentage value as integer. I ended up with this:
For my use case, it is correct as I don't want to store more than 2 decimals. Using the type decimal is inconvenient as it is stored as string with the Postgres driver. Hence this choice.
But my question is about the caveats of this technique. Does the in & out conversion affect the performance in a noticeable way?
3 replies
ReferenceError on something that should (and DO) exist
tl;dr: getting a reference error on an existing (declared and in scope) variable:
The best is to check this reproductible example:
https://stackblitz.com/github/binajmen/budget?file=src%2Fpages%2Fcategories.tsx
I'm pretty sure I'm doing something wrong, but I can't figure out what..
2 replies
DTDrizzle Team
•Created by binajmen on 11/29/2023 in #help
`.orderBy` influence `sql` output
With the following code:
I get the following output:
Why would the
orderBy
influence the computed column isUsed
(the expected result is true
)?9 replies
DTDrizzle Team
•Created by binajmen on 11/28/2023 in #help
Why is 1 and 0 are returned as string?
With the following:
I get
isUsed
as "1"
or "0"
whereas I would expect a boolean.33 replies
How to choose between Store and Context?
I've gathered that a store can reside in its own file and be imported in multiple locations, acting as a shared state. Given this, why would I opt for a context when a store seems capable of handling the task?
Whether it's for theming or authentication status, a store seems apt. Is there an advantage to using a context, or some trade-offs or crucial factors I might be overlooking?
4 replies
How do you consume server actions response?
It might look as a silly question, but it is unclear for me how you must consume the response (either is it
result
or error
).
If the action failed (form validation, db error, etc.), I'd like to retrieve this info in the response. In the network tab, the result
as the type Response
(it makes sense). However, how am I suppose to consume the response and extract the JSON I'm sending from the action?4 replies
DTDrizzle Team
•Created by binajmen on 8/7/2023 in #help
Is it possible to have nested values when doing a leftJoin?
If not, what is your approach when you're not using the query builder? Should I map the results and enrich them based on the
financialInstitutionId
? Or is there something I missed?33 replies