Skip to content

Perf: Replace empty setState(() {}) calls with scoped reactive builders #531

Description

@ZhuchkaTriplesix

Description

There are numerous occurrences of empty setState(() {}) calls triggering full re-renders across the codebase.

Why is this a problem?

Calling setState without updating a specific state variable often implies that the widget is reacting to an external variable or Listenable changing, or simply forcing a whole-tree rebuild. This is an anti-pattern that leads to unnecessary UI redraws and can cause jank on complex panels.

Proposed Solution

Refactor these calls to use scoped reactive builders like ValueListenableBuilder, ListenableBuilder, or scoped state management solutions. This ensures that only the exact sub-tree dependent on the data is rebuilt, saving CPU cycles.

Areas affected

  • MongoDatabaseDialog
  • RedisExplorerView
  • PreferencesAppearanceSection
  • Various other widgets using this pattern.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions