Skip to content
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

refactor: simplify forcing update #4

Merged
merged 3 commits into from
Apr 6, 2023
Merged

Conversation

amirhhashemi
Copy link
Contributor

@amirhhashemi amirhhashemi commented Apr 5, 2023

I'm not exactly sure if it's any better in terms of performance but I think this is a simpler approach. It has two benefits that I can think of:

  1. It doesn't create a new array every time a transaction happens.
  2. Equality check is not needed: Every time setSignal gets called, Solid runs oldValue === newValue to check if the value is actually changed. With this approach this check is not needed.

https://www.solidjs.com/docs/latest/api#options

@lxsmnsyc
Copy link
Owner

lxsmnsyc commented Apr 5, 2023

I think forceUpdate can still be kept. I'm not sure if the transaction event passes a value but if it does, it's unideal to be kept in memory (by writing it into a signal), so it's better to do a 0-arity function like forceUpdate, but sure, that equals option should be better

@amirhhashemi
Copy link
Contributor Author

Good point, I fixed it.

@lxsmnsyc
Copy link
Owner

lxsmnsyc commented Apr 6, 2023

Thanks!

@lxsmnsyc lxsmnsyc merged commit d5a799d into lxsmnsyc:main Apr 6, 2023
@amirhhashemi amirhhashemi deleted the patch-2 branch April 6, 2023 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants