-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade Gosling #3
Conversation
// FIXME: This is a workaround to fix the zoomTo issue | ||
// The zoomTo function is not working properly when it is called immediately. | ||
setTimeout(() => { | ||
gosRef.current?.api.zoomTo(viewId, position, padding, duration) | ||
}, 150) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where I added a setTimout to get around the zoom problem.
setTimeout(() => { | ||
if (gosRef.current && gosAPI) { | ||
const { viewId, action, duration } = gosAPI | ||
const viewIds = gosRef.current.api.getTrackIds() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we changing the api from view ids to track ids? If yes, would it be better to just name the variables as trackIds?
Upgrades
Refactor Streamlit component to use the current Gosling API. This involved implementing several workarounds.
Screen.Recording.2024-06-05.at.6.12.17.PM.mov
Details
Naively updating Gosling/HiGlass/Pixi caused this PIXI-related export issue: pixijs/pixijs#8554
I discovered that the old
react-scripts
used a version of Webpack that was the source of the problem. I upgradedreact-scripts
which also required other dependencies to be upgraded. Eventually,npm run build
worked properly.I tested it with https://github.com/wangqianwen0418/streamlit-gosling-demo and found that the zoomTo functionalities were now broken. So I put the Gosling component in a useMemo. This solved the problems except that the first time zoomTo was used it would never work, it would just zoom out all the way. So I had to get creative with the setTimeouts.
I think the problem is something with the way the streamlit component is configured. This would be something to look into in a future PR, but everything seems to be working for now.