Chris P Bacon
Understanding Solid reactivity with console.log
well, you have to calculate all of them no? the definition of isActive is if the doc's id is the same as the selectedId. so if you change the selectedId then you will need each item to check if that id is the same as theirs
35 replies
Understanding Solid reactivity with console.log
just for my understanding than. isn't it bad practice to create that stuff outside of the render tree? I always avoid creating top level signals and such for the same reason. or at least I think it is for the same reason
35 replies
Understanding Solid reactivity with console.log
aaaaah, I see why, you are using
uiStore.state.activeDocID
inside of your memo. since the uistore is also a reactive store this means that your memo is tracking both the internal store of the doc itself. and also the uistore. This is also the behavior you want, because otherwise your isActive
would never update.35 replies
Understanding Solid reactivity with console.log
I'm still trying to decypher the code to understand why your memo is triggering for each and every click. A couple of things that I initially spot that might or might not be a cause of your bug:
1. the circular dependency of
uistate.js
and doc.js
is either already, or will in the future, cause you problems
2. why are you calling createRoot
? this is a helper from solid which in meant to initialize the reactive system, so normally you only do this once in order to 'mount' solid to the DOM.35 replies
How to dynamically 'render' a string interweaved with `<span />`'s
that is what I've done, which is also where the 'error' comes from. let's say I am at position x and I press a key in order to insert a letter. so before the insertion I store the cursor position, let the insert and rerender happen, then restore the cursor to pos x. well, that's wrong, because you are now at x+1. that's what I meant earlier. I realize now that I likely was not clear. I was sharing my thoughts, not asking a question. sorry for the confusion.
I managed to solve the whole editor thing for the most part, pretty happy with where I ended up. Besides the spelling and grammar checking I also wanted to do bi-directional conversion between markdown and html. So I implemented a solution usinf unified with remark and rehype. and for error marking I created a plugin that adds the nodes to the ast instead of trying to insert it into the string as html.
In case you are curious: https://github.com/chris-kruining/calque/blob/main/src/features/source/source.ts
18 replies
How to dynamically 'render' a string interweaved with `<span />`'s
I think you are on the money!
I've actually for the most part managed to solve my issue by using the selection solid primitive. it is a really nice wrapper around the native selection API!
Only issue I have left to solve is that I need to figure out what mutations to the text cause which mutations to the cursor position.
i.e. when you insert 1 character the cursor should advance by 1.
18 replies
Dependency error using npm init solid@latest
ooooh, seems vinxi got updated yesterday 🥳
https://github.com/solidjs/solid-start/pull/1778
17 replies