-
Notifications
You must be signed in to change notification settings - Fork 229
refactor(compass-schema): replace reflux with redux COMPASS-8797 #6656
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
Conversation
packages/compass-schema/src/components/coordinates-minichart/coordinates-minichart.jsx
Outdated
Show resolved
Hide resolved
_trackSchemaAnalyzed(analysisTime, query); | ||
|
||
dispatch(onSchemaSampled()); | ||
} catch (err: any) { |
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.
I haven't looked at what exactly analyzeSchema
is doing with the signal, but usually aborting a signal results in promise rejection, so we probably want to check for that here so that stop and error are not dispatched at the same time? I think the usual pattern for this we use is instead of subscribing to signal, you'd check on error that it's caused by signal being aborted and then dispatch accordingly
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.
in this case analyzeSchema returns null when it's cancelled:
if (dataService.isCancelError(err)) { |
the null schema is then handled by AnalysisFinishedAction. Hmm.. and I added a superfluous AnalysisCancelledAction, let me clean that up
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.
Looking good, left a couple comments/thoughts! This should make testing the store a lot smoother from the look of things also.
b825683
to
c61a63b
Compare
geo_data: schema ? schemaContainsGeoData(schema) : false, | ||
analysis_time_ms: analysisTime, | ||
}); | ||
track('Schema Analyzed', trackEvent, connectionInfoRef.current); |
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.
Also I understand that it's something that's already working like this, but it might make sense to ask product if they expect that this is tracked when analysis is canceled
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.
Thank you for pointing this out! Waiting for confirmation, but we'll likely split this as part of https://jira.mongodb.org/browse/COMPASS-8818
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.
A few very small comments, but otherwise looks good, nice cleanup
|
||
export const stopAnalysis = (): SchemaThunkAction<void> => { | ||
return (dispatch, getState, { abortControllerRef }) => { | ||
if (!abortControllerRef) return; |
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.
Based on types and the plugin setup code this value is always there, so this check is not doing anything, what's the purpose?
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.
ah, that was supposed to check for .current, thanks for spotting!
Description
Main changes:
setState
calls replaced with a reducerSide changes:
Math.random
)Note: still figuring out how to test the geoLayers
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes