allen-cell-animated / website-3d-cell-viewer

Other
5 stars 5 forks source link

fix: Fix initial URL parameters being ignored #236

Closed ShrimpCryptid closed 3 months ago

ShrimpCryptid commented 4 months ago

Fixes a bug where initial URL parameters were not being loaded correctly.

Estimated review size: tiny, <5 minutes

I realized that certain view settings weren't being pulled correctly from the URL-- this was both because I was accidentally overwriting them (oops) but also because of a more complex issue with ImageViewerApp.

It turns out that the ImageViewerApp only uses passed props as initial values, and ignores all future updates to them. To fix this, I initialized the viewer args + settings as null in AppWrapper and block rendering of the ImageViewerApp until they are loaded for the first time. This way the args + settings are complete the first time they are passed into ImageViewerApp.

Testing

  1. Clone the branch and start the dev server using npm run start.
  2. Open the following link in your browser: http://localhost:9020/viewer?url=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fbisque.allencell.org%2Fv1.4.0%2FCell-Viewer_Thumbnails%2FAICS-22%2FAICS-22_8319_2025_atlas.json&view=Z
  3. You should see the XY view mode be selected.