Skip to content

Fix timegraph misalignment when analysis running#1210

Merged
PatrickTasse merged 1 commit intoeclipse-cdt-cloud:masterfrom
PatrickTasse:margin
Jul 2, 2025
Merged

Fix timegraph misalignment when analysis running#1210
PatrickTasse merged 1 commit intoeclipse-cdt-cloud:masterfrom
PatrickTasse:margin

Conversation

@PatrickTasse
Copy link
Contributor

What it does

Wait for table header to be rendered before setting top margin.

Fixes #1207

How to test

Remove trace from trace viewer if it exists, to make sure analyses haven't run
Open a timegraph output with a slow analysis, or use breakpoint in analysis to simulate a delay
Wait for analysis to complete, or exit the breakpoint
Observe that timegraph has a top margin equal to tree header and rows are aligned with the tree

Follow-ups

N/A

Review checklist

  • As an author, I have thoroughly tested my changes and carefully followed the instructions in this template

@aaanh
Copy link
Contributor

aaanh commented Jun 30, 2025

I was able to replicate the margin bug and validate bug fix to be functional.

Wait for table header to be rendered before setting top margin.

Fixes eclipse-cdt-cloud#1207

Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Copy link
Contributor

@aaanh aaanh left a comment

Choose a reason for hiding this comment

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

Check condition now depends on whether or not the headers and items exist and non-empty.

}

private async setMarginTop() {
const header = await this.waitForHeader();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should verify that waitForHeader is executed for a minimal number calls. If not then, it should be called in a useEffect hook with an empty dependency array or the state that we're looking for changes.

Example

useEffect(() => {}, [empty or headersState])

Comment on lines 411 to 418
const getHeader = () => {
const header = this.treeRef.current?.querySelector('th');
if (header) {
resolve(header);
} else {
requestAnimationFrame(getHeader);
}
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid nested function definition if possible, might cause mem leak

Copy link
Contributor

@bhufmann bhufmann left a comment

Choose a reason for hiding this comment

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

I confirm that the fix works. Thanks for investigating this.

@PatrickTasse PatrickTasse merged commit 20533a5 into eclipse-cdt-cloud:master Jul 2, 2025
8 checks passed
@PatrickTasse PatrickTasse deleted the margin branch July 2, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Timegraph misalignment when analysis running

3 participants