Skip to content

perf: scope filter animation to mutation site, cache per-table filters#531

Merged
datlechin merged 1 commit intomainfrom
perf/animation-scope-filter-cache
Mar 31, 2026
Merged

perf: scope filter animation to mutation site, cache per-table filters#531
datlechin merged 1 commit intomainfrom
perf/animation-scope-filter-cache

Conversation

@datlechin
Copy link
Copy Markdown
Collaborator

Summary

  • Moved filter panel animation from parent .animation() to withAnimation at mutation site.animation(value: filterStateManager.isVisible) on the results section parent caused SwiftUI to re-evaluate the entire view tree 12+ times per frame during the 0.2s transition. Now withAnimation is called inside toggle()/show()/close() on FilterStateManager, scoping the animation to only the filter panel transition.
  • Removed .animation(value: tab.errorMessage) — error banners should appear instantly, no need for animation on the entire results section.
  • Added per-table filter cache to FilterSettingsStorageloadLastFilters(for:) was decoding JSON from UserDefaults on every table switch. Now cached in memory, invalidated on save/clear.

Test plan

  • Toggle filter panel — verify smooth slide animation still works
  • Trigger a query error — verify error banner appears instantly (no animation delay)
  • Switch between tables — verify filters load correctly (cached after first load)
  • Save filters on table A, switch to B, switch back to A — verify A's filters are preserved
  • Clear filters — verify cache is invalidated

@datlechin datlechin merged commit caa53c8 into main Mar 31, 2026
2 checks passed
@datlechin datlechin deleted the perf/animation-scope-filter-cache branch March 31, 2026 07:17
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