-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fine-grained reactivity for real-time report #3086
Comments
I like the idea of rolling our own, it doesn't seem like much is needed to replicate (integrate) the |
If I understand correctly, the main purpose would be the expensive re-calculation of the metrics on large reports, even though not much has actually changed. I don't really see yet how just signals would help with that (or what the API would look like). Would it be an 'Observable' like object that you call an update on and it then lets Lit know to re-render?
Mutability?!? Are you trying to give me a heart-attack? You could do something sort-of similar to what metrics-scala does, which is a tree structure. Each node calculates its own mutation score, and updating a mutant just means replacing the relevant nodes, reusing the non-changed ones. Another option might be to add a parameter to Either way I think you still need some sort of change detection in metrics app component that will generate the new metrics |
Yeah, it turned out to be wishful thinking on my part. It cannot be 'very small', as we also need a 'signal aware' All things considered, using the signals proposal pollyfil would be the better strategy. We can use signal-utils for a @hugo-vrijswijk @xandervedder thoughts? |
We would be able to get rid of the whole "reactivate" shenanigans, which will make the code easier to understand and reason about.
Hmm interesting. I assumed it would safe on performance as we now rerender all components on every change (including the source code parsing, instrumenting, etc.). This change would make sure only the necessary parts rerender (where the changes occurred). Would you like me to add a 'performance test'? I was thinking to use the checker.ts file as a performance test. |
Agreed, this simplifies things a lot.
I would like to see the performance increases compared to not using the signals 🙂. |
I want to introduce fine-grained reactivity to the HTML report.
Current situation
In the current situation, real-time updates are implemented ad hoc. This means that
metrics
are used to calculate the model. Subsequent updates result in recalculating the whole model. Code is rendered and drawn on the screen. To get acceptable performance, changes that are streaming in are buffered. I think this makes it unusable for big code files (like the one found in the TypeScript project).Suggested improvement.
I want to create a small signals library right into the
metrics
package. This would allow devs to update the status of a mutant, resulting in cascading changes in the entire model (so file metrics and parent directory metrics). Next, we could wire up these signals into the "reactive" base class we are currently using, drawing inspirations from@lit-labs/preact-signals
.The result is that changes to the model automatically cascade to the screen, no need for the custom update code we use now.
I want to implement this as a breaking change to keep things simpler.
Alternatives I've considered
metrics
like this, and keep the rest of the API the same:@lit-labs/preact-signals
directly frommetrics
and use that library. However, this would add a dependency tometrics
, which also adds that dependency to all dependents, like the dashboard and StrykerJS. Also, if lit-labs ever decided on a different Signals API, it would mean further breaking changes. As stated in their blog, they landed on preact-signals with little consideration.The text was updated successfully, but these errors were encountered: