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

AdHocFiltersCombobox: Prevent updating combobox options when input type changed during fetch #982

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

Sergej-Vlasov
Copy link
Contributor

@Sergej-Vlasov Sergej-Vlasov commented Nov 28, 2024

Fixes concurrency issue during options update in ad hoc filters combobox.

📦 Published PR as canary version: 5.28.1--canary.982.12087080743.0

✨ Test out this PR locally via:

npm install @grafana/[email protected]
npm install @grafana/[email protected]
# or 
yarn add @grafana/[email protected]
yarn add @grafana/[email protected]

@Sergej-Vlasov Sergej-Vlasov added type/bug Something isn't working patch Increment the patch version when merged release Create a release when this pr is merged area/variables Issues related to variables system in scenes labels Nov 28, 2024
@Sergej-Vlasov Sergej-Vlasov self-assigned this Nov 28, 2024
@Sergej-Vlasov Sergej-Vlasov force-pushed the serge/fix-combobox-options-fetch-concurency branch from 26889bf to 39b7462 Compare November 28, 2024 17:14
@dprokop dprokop requested review from a team and kaydelaney and removed request for a team November 29, 2024 13:50
Comment on lines +236 to +237
// if input type changed before fetch completed then abort updating options
// this can cause race condition and return incorrect options when input type changed
Copy link
Member

Choose a reason for hiding this comment

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

how can this happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As we discussed on a call:
Outdated options fetches are not cancelled and therefore can have concurrency issues - older more expensive calls (values) can finish later than newer faster calls (operators) and this results in values replacing operators in dropdown options as example. Ideal solution requires making those calls cancellable but while this is in progress (due to more effort) I introduced a quick fix to prevent this bug in most cases

@Sergej-Vlasov Sergej-Vlasov merged commit 355331d into main Nov 29, 2024
5 checks passed
@Sergej-Vlasov Sergej-Vlasov deleted the serge/fix-combobox-options-fetch-concurency branch November 29, 2024 15:18
@scenes-repo-bot-access-token
Copy link

🚀 PR was released in v5.28.1 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/variables Issues related to variables system in scenes patch Increment the patch version when merged release Create a release when this pr is merged released type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants