S
SolidJS14mo ago
kagami.h

Idiomatic way to change 2 derived signals when input signal changes

Hi, I've created a discussion at github https://github.com/solidjs/solid/discussions/1953 but it seems not very active place there. Sorry for duplicate.
GitHub
Idiomatic way to change 2 derived signals when input signal changes...
Hi! Great framework! I read the docs on createSignal, createMemo, createComputed multiple times but haven't found a way to solve this problem: import { render } from "solid-js/web"; i...
7 Replies
bigmistqke
bigmistqke14mo ago
you could do something like createEffect(on(inputItems, () => setShowLastX(SHOW_PER_PAGE)))
bigmistqke
bigmistqke14mo ago
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
bigmistqke
bigmistqke14mo ago
ideally you don't set signals in effects either, but i think in this case it's fine
kagami.h
kagami.hOP14mo ago
got it, thanks. can we be sure that items is only calculated once when inputItems changes? because (inputItems->allItems->items) and (inputItems->effect->setShowLastX->items). i.e. items depends on two different things
bigmistqke
bigmistqke14mo ago
a i see, no ur right it will run twice when pressing change input items (nvm what i said about computed, had a bug in the code)
bigmistqke
bigmistqke14mo ago
Solid Playground
Quickly discover what the solid compiler will generate from your JSX template
kagami.h
kagami.hOP14mo ago
thanks!
Want results from more Discord servers?
Add your server