-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
ref(pagefilters) move isSelectionEqual outside of utils #107978
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
base: master
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,246 @@ | |||
| import {OrganizationFixture} from 'sentry-fixture/organization'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file was the only one that was using the isSelectionEqual, so I've moved the functionality here and added the tests. Eod, it is up to the consumers to detect this and not something that pageFilters should provide functionality for.
| @@ -1,64 +0,0 @@ | |||
| import type {Location} from 'history'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this by moving the filters to the appropriate locations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| import {createStore} from 'reflux'; | ||
|
|
||
| import {getDefaultSelection} from 'sentry/components/pageFilters/utils'; | ||
| import {getDefaultPageFilterSelection} from 'sentry/components/pageFilters/actions'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Circular dependency between store and actions modules
Medium Severity
Moving getDefaultPageFilterSelection into actions.tsx creates a circular dependency: store.tsx imports from actions.tsx, and actions.tsx imports PageFiltersStore from store.tsx. Critically, getDefaultPageFilterSelection() is called at module-level evaluation time (line 49) to initialize the store's state. Previously, both modules imported from utils.tsx, avoiding this cycle. This works today only because export function declarations are hoisted, but it's fragile — refactoring to an arrow function or changing the bundler could cause a runtime crash.
Additional Locations (2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I didn't notice it. I need to separate more logic here, this is all quite messy, but I'll find a better place for it
| import {createStore} from 'reflux'; | ||
|
|
||
| import {getDefaultSelection} from 'sentry/components/pageFilters/utils'; | ||
| import {getDefaultPageFilterSelection} from 'sentry/components/pageFilters/actions'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit!


Merge some page filter modules that have been scattered around the different files, but have matching or similar implementations.