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

Fix zustand store initialization and add hook for initial coordination values #1587

Merged
merged 15 commits into from
Jun 30, 2023

Conversation

keller-mark
Copy link
Member

@keller-mark keller-mark commented Jun 6, 2023

Fixes #1486
Fixes #1577

Related to #1571

TODO

  • Get working for multiple linked python widgets in same notebook (bidirectional communication)
    • Figure out whether top-level uid is always needed (since when paired with onConfigChange in controlled component situation, it breaks the ability to leverage the config object reference)
      const newUid = uid || getNextScope([]);
    • Add React prop to allow bypassing validation during usage as a controlled component (if python knows the view config came from an onConfigChange event, then would bypass validation (for performance). otherwise (e.g., if the config traitlet is updated from the python side), then re-validate.
    • Look into preserving config object reference through all transformations (upgrade functions and zustand "reducer"s - and traitlet updates on python side)
  • Check dynamic opacity functionality
  • Test in vitessce-python and portal-ui

Change List

  • Add useInitialCoordination hook to get the values of the coordination space from the initial config, which can be used for viewState reset buttons.
  • Use config object reference as hook dependency when no config.uid is present (to support both controlled and un-controlled component cases).
  • Initialize Zustand store using closure over createViewConfigStore function, rather than via useEffect.

Checklist

  • Ensure PR works with all demos on the dev.vitessce.io homepage
  • Open (draft) PR's into vitessce-python and vitessce-r if this is a release PR
  • Documentation added or updated

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

Size Change: +1.04 kB (0%)

Total Size: 11.4 MB

Filename Size Change
./packages/main/prod/dist/index-********.js 6.93 MB +1.04 kB (0%)
ℹ️ View Unchanged
Filename Size
./packages/main/prod/dist/deflate-********.js 243 B
./packages/main/prod/dist/hglib-********.js 4.34 MB
./packages/main/prod/dist/index.min.js 590 B
./packages/main/prod/dist/jpeg-********.js 15.3 kB
./packages/main/prod/dist/lerc-********.js 47.2 kB
./packages/main/prod/dist/lzw-********.js 2.1 kB
./packages/main/prod/dist/packbits-********.js 576 B
./packages/main/prod/dist/pako.esm-********.js 68.6 kB
./packages/main/prod/dist/raw-********.js 168 B
./packages/main/prod/dist/webimage-********.js 872 B

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2023

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 77.3% 8575 / 11093
🔵 Statements 77.3% 8575 / 11093
🔵 Functions 64.7% 253 / 391
🔵 Branches 78.61% 820 / 1043
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
packages/vit-s/src/VitessceGrid.js 96.77% 75% 100% 96.77% 74-76, 121
packages/vit-s/src/state/hooks.js 60% 100% 28.2% 60% 56-66, 68-75, 77-89, 98-102, 119-125, 166-170, 197-208, 227-252, 255-273, 281-282, 299-361, 376-380, 396-404, 407, 426-451, 460-461, 478-492, 508-511, 528-549, 610-611, 620-621, 630-631, 640-641, 650-651, 660-666, 674-675
Generated in workflow #2877

@keller-mark keller-mark merged commit fb212df into main Jun 30, 2023
@keller-mark keller-mark deleted the keller-mark/zustand branch June 30, 2023 16:00
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.

Hook to get initial coordination values Initialize Zustand state from props properly
1 participant