crabnebula-dev / devtools

Inspect and Debug your Tauri applications in style 💃
https://devtools.crabnebula.dev
Other
287 stars 8 forks source link

fix: add different way to autoscroll #326

Closed johann-crabnebula closed 4 months ago

johann-crabnebula commented 4 months ago

To be honest I am not quite sure about this PR.

For some reason the internal way of Tanstack Virtual to scroll the virtual list does not play nice with new and dynamic size entries coming into the mix.

The only way I found for now was to use the calculated height on element and a grace period to make sure the scroll happens after the size was determined.

Also had to handcode a scroll direction detection since the internal one from Tanstack Virtual will report scrolling backwards when the virtual list shrinks because of dropping elements. (Happens when you spam new entries, at some point you will get some faulty backscroll).

Addresses #320 Closes DT-189

netlify[bot] commented 4 months ago

Deploy Preview for cn-devtools-app ready!

Name Link
Latest commit bdd0711a88befac8337a26d2ad979134f5c6ae7d
Latest deploy log https://app.netlify.com/sites/cn-devtools-app/deploys/66826993a084ec00083b03e6
Deploy Preview https://deploy-preview-326--cn-devtools-app.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

alex-crabnebula commented 4 months ago

I'm not too sure about the functionality myself, even beyond the way it is currently implemented. It seems to get more in the way than being helpful. We had a similar issue with our chat window in GoToMeeting; Our solution was to scroll automatically only if the previous last entry was at least in the view. This way, we needed no requestAnimationFrame, because the event was the adding of new items.