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

perf: avoid unnecessary rerenders on the canvas #393

Merged
merged 1 commit into from
Feb 2, 2025

Conversation

Charlie-XIAO
Copy link
Contributor

@Charlie-XIAO Charlie-XIAO commented Feb 2, 2025

Similar to part of #370 but improved.

  • App rerenders only when rescan, which is currently the possibility to add/remove widgets. This is achieved by useWidgetsStore(useShallow((state) => Object.keys(state.widgets))).
  • Each WidgetContainer rerenders only when its rendering information or settings change, i.e., WidgetContainers do not affect each other. This is achieved by useWidgetsStore((state) => state.widgets[id]).

I'm still uncertain about React.memo thing, thus not applying it here, but it is something to consider at some point.

@Charlie-XIAO Charlie-XIAO merged commit b2a76ff into main Feb 2, 2025
11 checks passed
@Charlie-XIAO Charlie-XIAO deleted the perf/canvas-rerender branch February 2, 2025 21: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.

1 participant