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

feat: OPTIC-1553: Add URL-based region visibility, hiding all but the specified region on load #6880

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

ddishi
Copy link

@ddishi ddishi commented Jan 9, 2025

PR fulfills these requirements

  • Commit message(s) and PR title follows the format [fix|feat|ci|chore|doc]: TICKET-ID: Short description of change made ex. fix: DEV-XXXX: Removed inconsistent code usage causing intermittent errors
  • Tests for the changes have been added/updated (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • Best efforts were made to ensure docs/code are concise and coherent (checked for spelling/grammatical errors, commented out code, debug logs etc.)
  • Self-reviewed and ran all changes on a local instance (for bug fixes/features)

Change has impacts in these area(s)

(check all that apply)

  • Product design
  • Backend (Database)
  • Backend (API)
  • Frontend

Describe the reason for change

Couldn't provide a URL to a specific region while maintaining context.

What does this fix?

(if this is a bug fix)

What is the new behavior?

The ability to read URL parameters in order open the task\annotation with only the specified region presented while all other regions are hidden.
image

What is the current behavior?

(if this is a breaking or feature change)

What libraries were added/updated?

(list all with version changes)

Does this change affect performance?

(if so describe the impacts positive or negative)

Does this change affect security?

(if so describe the impacts positive or negative)

What alternative approaches were there?

(briefly list any if applicable)

What feature flags were used to cover this change?

fflag_feat_front_optic_1553_url_based_region_visibility_short

Does this PR introduce a breaking change?

(check only one)

  • Yes, and covered entirely by feature flag(s)
  • Yes, and covered partially by feature flag(s)
  • No
  • Not sure (briefly explain the situation below)

What level of testing was included in the change?

(check all that apply)

  • e2e
  • integration
  • unit

Which logical domain(s) does this change affect?

(for bug fixes/features, be as precise as possible. ex. Authentication, Annotation History, Review Stream etc.)

Copy link

netlify bot commented Jan 9, 2025

👷 Deploy request for label-studio-docs-new-theme pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 04bb68e

Copy link

netlify bot commented Jan 9, 2025

👷 Deploy request for heartex-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 04bb68e

@github-actions github-actions bot added the feat label Jan 9, 2025
@ddishi
Copy link
Author

ddishi commented Jan 20, 2025

Hi @makseq,
Just following up as you suggested in the Slack channel. Could you please bump this PR to the relevant team?
Also, I ran into a merge conflict regarding the proxy config, where the version in main didn’t seem to work for me. Please see #6567, Any guidance there would be great.

Thanks! 🙏

@makseq makseq changed the title feat: DEV: Add URL-based region visibility, hiding all but the specified region on load feat: OPTIC-1553: Add URL-based region visibility, hiding all but the specified region on load Jan 22, 2025
@makseq
Copy link
Member

makseq commented Jan 22, 2025

@ddishi could you please rename your feature flag to this one:
fflag_feat_front_optic_1553_url_based_region_visibility_short
?

@bmartel
Copy link
Contributor

bmartel commented Feb 3, 2025

@ddishi Would you be able to add some tests for this change? Test case(s) for this can be added here:

@bmartel
Copy link
Contributor

bmartel commented Feb 5, 2025

Thanks a bunch @ddishi 🙏

@@ -214,22 +229,39 @@ export const AppStore = types

if (annotationID !== undefined) {
self.annotationStore.setSelected(annotationID);
} else {
self.taskStore.setSelected(taskID);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why the else case was removed?

Copy link
Author

@ddishi ddishi Feb 5, 2025

Choose a reason for hiding this comment

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

Because we need to load the task even if an annotationID is provided for the FF to work properly. We need to be able to choose both annotationID and taskID.
Also we always have taskID defined since we return otherwise.

Copy link
Contributor

Choose a reason for hiding this comment

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

But in the case of a defined annotationID we already have the task loaded and selected. We don't need to reload the task to switch annotations, that would incur an overhead which seems unnecessary.

Choose a reason for hiding this comment

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

@bmartel I believe that this is specifically not the case with the URL argument. Maybe there is some kind of race condition or something. We'd appreciate your input

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll have to look closer, but the reason I flagged this is because there are two cases that were originally handled in this function.

  1. Switching tasks
  2. Switching annotations within a task

The removal of the else case means that in the case we are only switching an annotation, we now would be always loading the task from the API even though it has not changed. There seems like there should be a way we can position this to avoid introducing an unnecessary API call for a task we already have.

@hlomzik does this make sense?

Copy link
Author

Choose a reason for hiding this comment

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

We checked it again and the feature seems to be working with the else block after all... I'll revert it.
Thanks for pointing that up 🙏🏼

@ddishi ddishi force-pushed the fb/focus-on-region-via-url branch from a5df055 to e458602 Compare February 6, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants