gosling-lang / streamlit-gosling

Gosling custom component for Streamlit
MIT License
10 stars 2 forks source link

chore: upgrade Gosling #3

Closed etowahadams closed 4 months ago

etowahadams commented 4 months ago

Upgrades

Refactor Streamlit component to use the current Gosling API. This involved implementing several workarounds.

https://github.com/gosling-lang/streamlit-gosling/assets/14843470/c3bb0ef5-aa38-4791-8dd5-e8e216b31420

Details

Naively updating Gosling/HiGlass/Pixi caused this PIXI-related export issue: https://github.com/pixijs/pixijs/issues/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.