Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Meta: fix some no-optional-chaining lint issues
#9399
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,12 +28,12 @@ function removeNotificationIndicator(element: HTMLElement): void { | |
| } | ||
| } | ||
|
|
||
| async function openUnreadNotifications(event?: React.MouseEvent): Promise<void> { | ||
| if (event?.target instanceof HTMLButtonElement) { | ||
| // Hide the tooltip | ||
| event.target.blur(); | ||
| event.target.disabled = true; // Prevent multiple clicks | ||
| } | ||
| async function openUnreadNotifications(event: React.MouseEvent<HTMLButtonElement>): Promise<void> { | ||
| // Hide the tooltip | ||
| event.currentTarget.blur(); | ||
|
|
||
| // Prevent multiple clicks | ||
| event.currentTarget.disabled = true; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case we'll also get events for the hidden hotkey |
||
|
|
||
| await showToast(async updateToast => { | ||
| const page = await fetchDomUncached('/notifications?query=is%3Aunread'); | ||
|
|
@@ -65,9 +65,7 @@ async function openUnreadNotifications(event?: React.MouseEvent): Promise<void> | |
| message: 'Loading notifications…', | ||
| doneMessage: false, | ||
| }).finally(() => { | ||
| if (event?.target instanceof HTMLButtonElement) { | ||
| event.target.disabled = false; | ||
| } | ||
| event.currentTarget.disabled = false; | ||
| }); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,15 +52,14 @@ function parseCurrentUrl(): string[] { | |
| return parts; | ||
| } | ||
|
|
||
| async function getLatestCommitToFile(branch: string, filePath: string): Promise<string | void> { | ||
| async function getLatestCommitToFile(branch: string, filePath: string): Promise<string> { | ||
| const {repository} = await api.v4(GetLatestCommitToFile, { | ||
| variables: { | ||
| branch, | ||
| filePath, | ||
| }, | ||
| }); | ||
| const commit = repository.object?.history.nodes[0]; | ||
| return commit?.oid; | ||
| return repository.object.history.nodes[0].oid; | ||
| } | ||
|
|
||
| async function getChangesToFileInCommit(sha: string, filePath: string): Promise<FileChanges | void> { | ||
|
|
@@ -140,10 +139,6 @@ async function getGitObjectHistoryLink(): Promise<HTMLElement | undefined> { | |
| } | ||
|
|
||
| const commitSha = await getLatestCommitToFile(url.branch, url.filePath); | ||
| if (!commitSha) { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A file exists, so its commit also exists |
||
| return; | ||
| } | ||
|
|
||
| const fileChanges = await getChangesToFileInCommit(commitSha, url.filePath); | ||
| if (!fileChanges) { | ||
| 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.
Dead code from #5090