-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
fix(autofix): Remove animations when navigating, handle comment popup overlap #88275
Conversation
const hasRootCauseStep = steps.some( | ||
step => step.type === AutofixStepType.ROOT_CAUSE_ANALYSIS | ||
); | ||
const hasSolutionStep = steps.some(step => step.type === AutofixStepType.SOLUTION); | ||
const hasChangesStep = steps.some(step => step.type === AutofixStepType.CHANGES); | ||
|
||
const isRootCauseFirstAppearance = hasRootCauseStep && !previousRootCauseRef.current; | ||
const isSolutionFirstAppearance = hasSolutionStep && !previousSolutionRef.current; | ||
const isChangesFirstAppearance = hasChangesStep && !previousChangesRef.current; | ||
|
||
previousRootCauseRef.current = hasRootCauseStep; | ||
previousSolutionRef.current = hasSolutionStep; | ||
previousChangesRef.current = hasChangesStep; |
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.
can't we achieve the same but in a much simpler way by just maintaining an isMounted
(or something similar if we need to wait for data to load) state for the whole drawer/all the steps, and anything that appears after initial mount is just considered that step being polled in?
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.
ok
const previousInsightsRef = useRef<AutofixInsight[]>([]); | ||
const [newInsightIndices, setNewInsightIndices] = useState<number[]>([]); | ||
|
||
// Compare current insights with previous insights to determine which ones are new | ||
useEffect(() => { | ||
if (insights.length === previousInsightsRef.current.length + 1) { | ||
setNewInsightIndices([insights.length - 1]); | ||
} else { | ||
setNewInsightIndices([]); | ||
} | ||
previousInsightsRef.current = [...insights]; | ||
}, [insights]); |
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.
is it possible to use the isMounted
implementation for insight cards too?
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.
It becomes more complex because that doesn't cover the expanding/collapsing of the insight card section, which doesn't cause a re-mount. For that to work, I have to track that state too, and then it's more complex than the current approach @jennmueng
… overlap (#88275) Remove animations when opening drawer and expanding insight section. Also increase clarity of which comment thread is focused when there are multiple.
Remove animations when opening drawer and expanding insight section. Also increase clarity of which comment thread is focused when there are multiple.