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

Add option to dismiss dialog #16269

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

RRosio
Copy link
Contributor

@RRosio RRosio commented May 1, 2024

References

Related to #8374

Code changes

This PR uses the showDialog function to display an error message with a checkbox giving the user the option to dismiss the popup dialog for the remainder of their tab session.

User-facing changes

The user will now see a clickable checkbox that allows them to dismiss the error dialog informing them their connection to the server was lost.

Screenshot 2024-05-01 at 12 10 47 AM

Backwards-incompatible changes

Not applicable

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@jtpio jtpio added this to the 4.3.0 milestone May 3, 2024
Copy link
Contributor

@JasonWeill JasonWeill left a comment

Choose a reason for hiding this comment

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

Thanks for opening this! I added a couple of comments. Also, when I checked out and ran your code, I found that if I stop the server, then see the dialog, then click somewhere on the page not in the dialog's body, the dialog goes away, and I don't see it again, even if I don't have the box checked. Is this something you could fix in this PR?

packages/application/src/connectionlost.ts Outdated Show resolved Hide resolved
packages/application/src/connectionlost.ts Outdated Show resolved Hide resolved
@RRosio
Copy link
Contributor Author

RRosio commented May 9, 2024

Thank you for your review @JasonWeill! OH I think I missed checking for that but I will update this with the appropriate fix for that, thank you for letting me know!

Comment on lines +34 to +35
const key = 'server-connection-error';
const promise = connectionLostCachePromise[key];
Copy link
Member

Choose a reason for hiding this comment

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

After the recent changes, I do not see a reason for this to be a mapping if the key is constant.

return promise;
} else {
try {
const errorDialogPromise: any = showDialog({
Copy link
Member

Choose a reason for hiding this comment

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

New code should not use any except for tests. any disables type checking and in past lead to numerous user-facing bugs. This will be enforced with #16219

import { ServerConnection, ServiceManager } from '@jupyterlab/services';
import { ITranslator, nullTranslator } from '@jupyterlab/translation';
import { IConnectionLost } from './tokens';

let displayConnectionLost = true;
const connectionLostCachePromise: { [key: string]: Promise<any> } = {};
Copy link
Member

Choose a reason for hiding this comment

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

New code should not use any except for tests. Any disables type checking and in past lead to numerous user-facing bugs. This will be enforced with #16219

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review @krassowski I will implement those changes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants