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

feature: Sync vector state to URL #488

Merged
merged 20 commits into from
Dec 14, 2024
Merged

feature: Sync vector state to URL #488

merged 20 commits into from
Dec 14, 2024

Conversation

ShrimpCryptid
Copy link
Contributor

@ShrimpCryptid ShrimpCryptid commented Dec 3, 2024

Problem

Closes #471, "sync vector state to URL."

Estimated review size: small, 15 minutes

Solution

  • Adds handlers for serializing and deserializing vector URL state.
  • Updates names for some decoding methods to simplify url_utils parsing.

Type of change

  • New feature (non-breaking change which adds functionality)

Steps to Verify:

  1. Open preview link: https://allen-cell-animated.github.io/timelapse-colorizer/pr-preview/pr-488/viewer?collection=https%3A%2F%2Fallencell.s3.amazonaws.com%2Faics%2Fnuc-morph-dataset%2Ftimelapse_feature_explorer_datasets%2Flineage-annotated_dataset%2Fcollection.json&dataset=Small&feature=volume&t=251&vc=1&vc-color=ff0000&vc-key=_motion_&vc-scale=18&vc-time-int=12&vc-tooltip=c
  2. You should see the same settings as below:

image

@ShrimpCryptid ShrimpCryptid added the new feature New feature or request label Dec 3, 2024
@ShrimpCryptid ShrimpCryptid self-assigned this Dec 3, 2024
Copy link

github-actions bot commented Dec 3, 2024

PR Preview Action v1.4.8
Preview removed because the pull request was closed.
2024-12-14 00:24 UTC

Copy link

github-actions bot commented Dec 3, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 75.34% 5313 / 7052
🔵 Statements 75.34% 5313 / 7052
🔵 Functions 58.67% 142 / 242
🔵 Branches 81.19% 449 / 553
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/colorizer/types.ts 99.11% 100% 80% 99.11% 125-126
src/colorizer/utils/url_utils.ts 91.78% 94.73% 90% 91.78% 105-111, 116-138, 203-209, 239-250, 307-308, 584-591
Generated in workflow #1276

@ShrimpCryptid ShrimpCryptid changed the base branch from main to feature/onscreen-backdrops-toggle December 3, 2024 22:43
@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review December 3, 2024 22:52
@ShrimpCryptid ShrimpCryptid requested a review from a team as a code owner December 3, 2024 22:52
@ShrimpCryptid ShrimpCryptid requested review from toloudis and ascibisz and removed request for a team December 3, 2024 22:52
Base automatically changed from feature/onscreen-backdrops-toggle to main December 5, 2024 22:26
Copy link
Contributor

@toloudis toloudis left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -56,6 +59,12 @@ enum UrlParam {
SCATTERPLOT_Y_AXIS = "scatter-y",
SCATTERPLOT_RANGE_MODE = "scatter-range",
OPEN_TAB = "tab",
SHOW_VECTOR = "vc",
VECTOR_KEY = "vc-key",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this the "feature name"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, it's the equivalent!

return isHexColor(value) ? new Color(value) : undefined;
}

function decodeFloat(value: string | null): number | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we not already have these functions in this codebase? surprising!

@ascibisz
Copy link

When I was playing around on the preview link, almost everything was working as I would expect (just the basic changing something in the vector arrows menu, seeing the change in the UI, seeing that change in the URL, refreshing with that URL, seeing the state had been preserved in the UI because of the URL).

However, when I un-check "Show vector arrows", I see the change in the UI, but I don't see the change in the URL, so of course when I refresh, the vector arrows are back again and the box is checked again. Is this expected? And is this happening for you too on the preview link?

@ShrimpCryptid
Copy link
Contributor Author

When I was playing around on the preview link, almost everything was working as I would expect (just the basic changing something in the vector arrows menu, seeing the change in the UI, seeing that change in the URL, refreshing with that URL, seeing the state had been preserved in the UI because of the URL).

However, when I un-check "Show vector arrows", I see the change in the UI, but I don't see the change in the URL, so of course when I refresh, the vector arrows are back again and the box is checked again. Is this expected? And is this happening for you too on the preview link?

Oh interesting, I'm seeing that behavior too. Let me debug this and I'll re-request you.

@ShrimpCryptid ShrimpCryptid marked this pull request as draft December 12, 2024 17:55
@ShrimpCryptid ShrimpCryptid marked this pull request as ready for review December 13, 2024 23:26
@ShrimpCryptid ShrimpCryptid merged commit e008267 into main Dec 14, 2024
3 checks passed
@ShrimpCryptid ShrimpCryptid deleted the feature/vector-urls branch December 14, 2024 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync vector state to URL
3 participants