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

refactor: Moved backdropKey, changed store access to use inline selector pattern (state pt. 10) #588

Open
wants to merge 5 commits into
base: refactor/zustand-state-refactor-9-config
Choose a base branch
from

Conversation

ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Mar 11, 2025

Problem

Part 10 of (12)??? for #492, "refactor state management."

This change is pretty unexciting. It moves the backdropKey into the DatasetSlice which cleans up some dependencies, and also changes our state access to the inline selector pattern which is better for linting & detecting deprecated dependencies.

Estimated review size: small, 10 minutes

Solution

  • Changed state accessors to use the inline selector pattern, removing dependence on useShallow.
  • Moved backdropKey into DatasetSlice, allowing DatasetSlice to be agnostic of BackdropSlice.
  • Added a listener for backdropKey in BackdropSlice to sync backdrop visibility.

Steps to Verify:

  1. Open PR preview: https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview/pr-588/viewer?dataset=https%3A%2F%2Fraw.githubusercontent.com%2Fallen-cell-animated%2Fcolorizer-data%2Frefs%2Fheads%2Fmain%2Fdocumentation%2Fexample_dataset%2Fmanifest.json
  2. Toggle backdrops on/off, try switching backdrops or datasets.
    (Note: there's a known bug when switching datasets/collections where the frame may be incorrect. I'm going to see if it goes away when I move more Dataset/Collection switching logic into the store.)

@ShrimpCryptid ShrimpCryptid added the internals Tech debt, refactoring, dependencies, etc. label Mar 11, 2025
@ShrimpCryptid ShrimpCryptid self-assigned this Mar 11, 2025
Copy link

github-actions bot commented Mar 11, 2025

PR Preview Action v1.4.8
🚀 Deployed preview to https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview/pr-588/
on branch gh-pages at 2025-03-11 23:12 UTC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to move backdropKey into the DatasetSlice because it's highly dependent on the dataset. This let me remove the dependency on BackdropSlice.

@ShrimpCryptid ShrimpCryptid force-pushed the zustand-state-refactor-10-cleanup branch from 8b43fc2 to 804fadf Compare March 11, 2025 22:55
@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review March 11, 2025 22:55
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner March 11, 2025 22:55
@ShrimpCryptid ShrimpCryptid requested review from meganrm and frasercl and removed request for a team March 11, 2025 22:55
@ShrimpCryptid ShrimpCryptid marked this pull request as draft March 11, 2025 22:56
Copy link

github-actions bot commented Mar 11, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.8% 7882 / 10002
🔵 Statements 78.8% 7882 / 10002
🔵 Functions 69.55% 265 / 381
🔵 Branches 84.64% 772 / 912
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/state/ViewerState.ts 95.12% 100% 100% 95.12% 116-121
src/state/slices/backdrop_slice.ts 100% 100% 100% 100%
src/state/slices/dataset_slice.ts 93.57% 95.23% 100% 93.57% 56-62
Generated in workflow #1552

@ShrimpCryptid ShrimpCryptid force-pushed the zustand-state-refactor-10-cleanup branch from 804fadf to 2a23519 Compare March 11, 2025 23:10
@ShrimpCryptid ShrimpCryptid changed the title refactor: Moved backdropKey, changed store access to use inline selector pattern refactor: Moved backdropKey, changed store access to use inline selector pattern (state pt. 10) Mar 11, 2025
@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review March 11, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internals Tech debt, refactoring, dependencies, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant