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

Fix trace explorer / welcome page refresh corner cases #230

Merged
merged 4 commits into from
Apr 10, 2024

Conversation

bhufmann
Copy link
Collaborator

@bhufmann bhufmann commented Mar 27, 2024

This PR consists of multiple commits that fixes refresh corner cases.

  1. Add default dispose() method to AbstractTraceExplorerProvider
    Call it from the webview dispose handler. Sub-class can add their own implementation and call super implementation. This avoids that the class is using the webview instance after it is disposed.

  2. Ignore connection status listener notification in constructor
    The TSP client implementation notifies clients when the method addConnectionStatusListener() is called. This can lead to incorrect state in on client side.

  3. Add method to set server status in TraceServerStatusService
    This method set the status bar and the traceViewer.serverUp context that is used to decide whether the trace explorer or the welcome view should be rendered. This method doesn't check the backend to get status in comparison to checkAndUpdateServerStatus. It's useful when it's known that the server is down or up (e.g. after start notification). In this case, it is not necessary to check the backend again. Don't set the status in the method isTraceServerUp() because it should not have side-effects that are not expected. Initialize and refresh flags traceViewer.serverUp and trace-explorer.noExperiments to ensure the correct view is rendered, i.e. Trace Explorer or Welcome view, when certain events happen (e.g. server started or stopped).
    Fixes Trace Explorer not refreshed after first trace server started indication #227
    Fixes Welcome Page not rendered after trace server stopped indication (intermittent) #228.

  4. Refresh trace viewer after server URL preference changes
    For the case that with current URL the welcome view is rendered due to no experiments on server, or the server is down, this will render the trace explorer (or welcome view) after a server URL change. Without calling refresh, the welcome view stays, even if the other server has experiments.
    Fixes Trace Explorer/Welcome page not refreshed when updating the server URL (corner case) #229

Signed-off-by: Bernd Hufmann [email protected]

@bhufmann bhufmann force-pushed the improve_refresh_detailed branch from 306f539 to 901c9b2 Compare March 27, 2024 18:35
@bhufmann
Copy link
Collaborator Author

Video showing fix for #227:

vscode-refresh-at-start

@bhufmann
Copy link
Collaborator Author

Video showing fix for #228

vscode-refresh-at-stop

@bhufmann
Copy link
Collaborator Author

Video showing fix for #229

vscode-refresh-at-change-url

@bhufmann bhufmann force-pushed the improve_refresh_detailed branch from 901c9b2 to 0b9403e Compare March 27, 2024 20:13
@bhufmann
Copy link
Collaborator Author

@williamsyang-work I found some corner cases for the refresh of the trace-explorer/welcome-view that this PR addresses. Please let me know if have any comments for this PR.

Comment on lines 20 to 27

RestClient.addConnectionStatusListener(status => {
// Ignore the first update that is sent when calling addConnectionStatusListener
if (this._initialized) {
this._signalHandler?.notifyConnection(status);
}
});
this._initialized = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar pattern to this: f565c23.

I wonder if there's a cleaner way to do this.

Copy link
Collaborator Author

@bhufmann bhufmann Apr 3, 2024

Choose a reason for hiding this comment

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

@williamsyang-work I'm not sure what you mean. What do you suggest to make it cleaner? Please let me know

Copy link
Contributor

Choose a reason for hiding this comment

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

I do like the implementation that William points-out slightly better. However this is simple enough that I don't mind either way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I think I understand how to change it. I'll update the PR (including a rebase).

@williamsyang-work
Copy link
Contributor

Thanks for the assist on this @bhufmann :)

Copy link
Contributor

@marcdumais-work marcdumais-work left a comment

Choose a reason for hiding this comment

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

LGTM - Very nice improvements for several corner-cases! Not only the views refresh correctly but it happens quicker now, without that little delay that was there in some cases previously. I confirmed that that 3 linked issues now seem resolved.

@marcdumais-work
Copy link
Contributor

marcdumais-work commented Apr 10, 2024

@bhufmann FYI, I noticed another corner case, that was already present before this PR, while testing: #236

Call it from the webview dispose handler. Sub-class can add their own
implementation and call super implementation.

This avoids that the class is using the webview instance after it is
disposed.

Signed-off-by: Bernd Hufmann <[email protected]>
The TSP client implementation notifies clients when the method
addConnectionStatusListener() is called. This can lead to incorrect
state in on client side.

Signed-off-by: Bernd Hufmann <[email protected]>
This method set the status bar and the serverUp context that is used
to decide whether the trace explorer or the welcome view should
be rendered.

This method doesn't check the backend to get status in comparison to
checkAndUpdateServerStatus. It's useful when it's known that the
server is down or up (e.g. after start notification). In this case, it
is not necessary to check the backend again.

Don't set the status in the method isTraceServerUp() because it should
not have side-effects that are not expected.

Initialize and refresh flags traceViewer.serverUp and
trace-explorer.noExperiments to ensure the correct view is rendered,
i.e. Trace Explorer or Welcome view, when certain event happen (e.g.
server started or stopped).

Fixes eclipse-cdt-cloud#227
Fixes eclipse-cdt-cloud#228

Signed-off-by: Bernd Hufmann <[email protected]>
For the case that with current URL the welcome view is rendered due to
noExperiment or server is down, this will render the trace explorer
(or welcome view) after a server URL change. Without calling refresh,
the welcome view stays, even if the other server has experiments.

Fixes eclipse-cdt-cloud#229

Signed-off-by: Bernd Hufmann <[email protected]>
@bhufmann bhufmann force-pushed the improve_refresh_detailed branch from 3655854 to 1f6b33a Compare April 10, 2024 19:12
@bhufmann
Copy link
Collaborator Author

@bhufmann FYI, I noticed another corner case, that was already present before this PR, while testing: #236

Thanks for providing this. I think that should be handled outside this PR in dedicated PR to fix #236.

@bhufmann bhufmann merged commit f012ced into eclipse-cdt-cloud:master Apr 10, 2024
6 checks passed
@bhufmann bhufmann deleted the improve_refresh_detailed branch April 10, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants