Skip to content
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

Merged
merged 9 commits into from
Jun 6, 2024
Merged

Conversation

etowahadams
Copy link
Contributor

@etowahadams etowahadams commented Jun 5, 2024

Upgrades

  • Gosling
  • HiGlass
  • PIXI

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 upgraded react-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.

Comment on lines +85 to +89
// 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)
Copy link
Contributor Author

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()
Copy link
Collaborator

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?

@wangqianwen0418 wangqianwen0418 merged commit e3b0ef5 into master Jun 6, 2024
5 checks passed
@wangqianwen0418 wangqianwen0418 deleted the etowahadams/upgrade-gosling branch June 6, 2024 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants