When switching between tabs the scroll position is lost.
Solution
We need to make sure when an editor is rendered, it scrolls back to where it was.
The state.openFiles objects have the instance of choo's component under the editor property.
Each choo component stores their own state independently of the main application state, so it makes sense to store the scroll position there instead of the main state.
Not cool
I think there is an edge case with large files that they take some time to fully load and that messes
The scroll listener and scrollTo are made in a timeout callback because I can't find out how to get a ready event from CodeMirror. :shrug:
Extra
I noticed that the tab wasn't being selected when you click on the device icon (cables or computer) so I wrote a little fix for that too.
Problem
When switching between tabs the scroll position is lost.
Solution
We need to make sure when an editor is rendered, it scrolls back to where it was. The
state.openFiles
objects have the instance of choo's component under theeditor
property. Each choo component stores their own state independently of the main application state, so it makes sense to store the scroll position there instead of the main state.Not cool
I think there is an edge case with large files that they take some time to fully load and that messes
The scroll listener and
scrollTo
are made in a timeout callback because I can't find out how to get aready
event from CodeMirror. :shrug:Extra
I noticed that the tab wasn't being selected when you click on the device icon (cables or computer) so I wrote a little fix for that too.