visualize-admin / visualization-tool

The tool for visualizing Swiss Open Government Data. Project ownership: Federal Office for the Environment FOEN
https://visualize.admin.ch
BSD 3-Clause "New" or "Revised" License
31 stars 3 forks source link

fix: Do not unmount sidebar content when data is being re-fetched #1460

Closed bprusinowski closed 5 months ago

bprusinowski commented 5 months ago

Closes #1459

This PR makes use of keepPreviousData property in data fetching hooks to not unmount sidebar contents on option change. It also improves the situation around content jumps when changing chart type.

How to test

PR

  1. Go to this link.
  2. ✅ Change chart type from column to line back and forth several times and see that there is only a small blink when doing so.
  3. Open Horizontal Axis.
  4. Change year filter either by using a slider or time picker.
  5. ✅ See that the sidebar is slightly dimmed when data is being loaded, mirroring the chart's behavior.

TEST

  1. Go to this link.
  2. ❌ Change chart type from column to line back and forth several times and see that it's noticeable that chart footnotes jump to the top for a brief moment when doing so.
  3. Open Horizontal Axis.
  4. Change year filter either by using a slider or time picker.
  5. ❌ See that the sidebar content is completely unmounted when the data is being loaded.
vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
visualization-tool ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 18, 2024 2:16pm
ptbrowne commented 5 months ago

Thanks 💯