View scroll position becomes stuck after switching documents

Steps to reproduce

  1. Create an item in a document with a lot of children (enough so that you have to scroll down).
  2. Zoom into the item.
  3. Scroll down.
  4. Switch to another document.
  5. Switch back to the first document.
  6. Scroll up to the top.
  7. Zoom out of the item.
  8. Zoom back into the item.

Expected result

On step 5 you should be scrolled to the position you were in before you switched documents. On step 8 you should be placed back at the top of the document since you scrolled back up in step 6.

Actual result

On step 8 you are put back to the position you were in when you first left the document in step 4.

It seems that the view position is set when switching documents, but is not properly reset after switching back to the document, causing incorrect behavior when switching in and out of this view from within the same document.

Repro video: https://streamable.com/gmhges

Environment

Chrome, Windows 10.

That’s wild haha. Thanks for the video though that definitely helped a lot; the text was quite difficult to wrap my head around.

Sounds like a bug, will fix.