Skip to content

fix: LEAP-1815: Fix initial image tool selection logic #7023

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

Merged
merged 4 commits into from
Feb 6, 2025

Conversation

Gondragos
Copy link
Collaborator

@Gondragos Gondragos commented Feb 5, 2025

PR fulfills these requirements

  • Commit message(s) and PR title follow 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)
  • The 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)

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

Describe the reason for change

There was a conflict between two features: default tool and preserved tool. Due to logic inconsistency, the second one annulated the first one even where there is no resolution about the selected tool yet.

isInitial flag is added to prevent a situation when the default tool sets a new preserved tool state to local storage before it was handled at all.

What does this fix?

It allows the default tool to be selected in case if the preserved tool was not found in the config.

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?

Image Tools

Adjusted the return statement placement within the tool selection logic to ensure proper flow and avoid unintended behavior.
…ntation

Introduces tests covering scenarios for default tool selection, preserved tool state, and invalid tool cases during initialization.
@github-actions github-actions bot added the fix label Feb 5, 2025
Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for label-studio-docs-new-theme canceled.

Name Link
🔨 Latest commit 2f79dd1
🔍 Latest deploy log https://app.netlify.com/sites/label-studio-docs-new-theme/deploys/67a4e3fc94e9030008b2fea5

Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for heartex-docs canceled.

Name Link
🔨 Latest commit 2f79dd1
🔍 Latest deploy log https://app.netlify.com/sites/heartex-docs/deploys/67a4e3fcd2b3bc00081bb2c2

@MihajloHoma
Copy link
Contributor

MihajloHoma commented Feb 6, 2025

/git merge

Workflow run
Successfully merged: create mode 100644 docs/source/guide/prompts_keys.md

@Gondragos Gondragos enabled auto-merge (squash) February 6, 2025 15:23
Add an `isInitial` flag to differentiate between initial and user-triggered tool selection. This prevents unnecessary actions during default tool assignment or preserved tool restoration. Updates ensure proper handling of state transitions with minimal side effects.
@Gondragos Gondragos merged commit 768db9d into develop Feb 6, 2025
34 checks passed
@Gondragos Gondragos deleted the fb-LEAP-1815/initial-image-tool branch February 6, 2025 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants