QWu4xYV
QWu4xYV
SSolidJS
Created by QWu4xYV on 5/24/2024 in #support
enableScheduling causes simple solid router examples to crash
Hi, I was going to file this as a bug, but wasn't sure if I should direct it at the router repo or the main solidjs repo. In short, I enabled scheduling with enableScheduling in an App I've been playing around with, in the hopes that it could help a bit with some perf issues. It didn't make too much of a difference, but I forgot to turn enableScheduling back off. When I added Router, I got weird errors that I eventually traced back to enableScheduling. Repro here: https://stackblitz.com/edit/solidjs-templates-gttqb3?file=src%2FApp.tsx,src%2Findex.tsx If this is expected behavior, I'd be curious to understand more 🙂
7 replies
SSolidJS
Created by QWu4xYV on 5/19/2024 in #support
Reactivity in single table cell from memoized data
[Moving from this thread (https://discord.com/channels/722131463138705510/1241054227485425734/1241622154437726360) since this is a separate question] Question: How do I do some transformation/aggregation on store data before displaying it in a tabular format, when I want only a single cell to update? For example, in https://stackblitz.com/edit/solidjs-templates-inkran?file=src%2FApp.tsx , I aggregate over each of the keys. With a createMemo and some use of prev, I can get just a single row to update, but would ideally just update a single cell. (My understanding is that in this case, because createMemo returns a Signal (not a Store), there isn't a good way to listen for nested values, but I'm not sure about that...) If I have my createMemo update prev in place, it seems that For/Index doesn't know that the update has happened (which makes sense), but if I create a new object for that row, even if a value hasn't changed for that index, it still updates anyway (in this case, the label "B"). The only other thing I can think of is to create a separate store that I then update in separate createComputed or something like that, but that feels a bit awkward... What am I still missing here?
11 replies
SSolidJS
Created by QWu4xYV on 5/17/2024 in #support
Reactivity in single cell in nested For tags
I have a large-ish (~20x20) table with cells that update very regularly. When only a single cell value changes, I would like to update only that cell, not all the cells in the row. I'm currently implementing this with nested For loops, but it seems like the inner loop always re-renders (which makes sense because the For children function gets called). Simplified example here: https://stackblitz.com/edit/solidjs-templates-jebc3v?file=src%2FApp.tsx I'm assuming there's a straightforward way to do this, but I can't see anything in the support section, docs, or github issues. Thanks for any help!
27 replies
SSolidJS
Created by QWu4xYV on 1/31/2024 in #support
Circular references in Stores?
Hi again, Solid community! Coming with another new person question 🙂 Is it possible to have circular references in Stores? I created a Playground which seems to indicate that it's not: https://playground.solidjs.com/anonymous/8f07d9c2-54da-43e9-8e08-88393f446bca If not, are there any recommended alternative patterns for this kind of thing? I can think of a few options, but haven't used Solid for very long yet, so would love to hear from others!
29 replies
SSolidJS
Created by QWu4xYV on 1/30/2024 in #support
Understanding memoization re-running
Hi everyone, I'm new to SolidJS (from React), but so far enjoying it! I was running into some unexpected behavior when dealing with memoization though, and I was wondering if someone could help me understand, or help me figure out if I had run into a bug (either in my code or in Solid). Solid Playground link: https://playground.solidjs.com/anonymous/2850a930-a45f-48d6-92ff-fc644cee0bbc Notice that if you click the "Add item" button below "SimpleMemo" multiple times, only a single item appears (unexpected), while if you click the other two, items continue to appear (expected). In the SimpleMemo case, I have a simple memoization function which uses a Map to memoize a function based on a single input arg. The function passed in is calling Solid's createMemo, so I have two layers of memoization. The outer "simpleMemo" is designed to memoize based on input arg, while the inner createMemo is designed to memoize based on Solid's reactive primitives. SimpleMemoInitialCall illustrates that if I call the memoization function once anywhere outside the JSX, it works fine. NonMemo illustrates that if I don't do the "simpleMemo"-izing, it also works fine. Can someone help me figure out why this is happening? Thank you!!
13 replies