Repository navigation
Enable useful-not-found-page on the new "404 file" page - #6840
Merged
Merged
Conversation
Support default branch button
fregante
reviewed
Aug 18, 2023
fregante
approved these changes
Aug 19, 2023
fregante
left a comment
Member
There was a problem hiding this comment.
LGTM so far. I'll see how it looks
Co-authored-by: Federico Brigante <[email protected]>
useful-not-found-pageuseful-not-found-page to the new "404 file" page
fregante
approved these changes
Aug 24, 2023
| const defaultLink = ( | ||
| <a | ||
| className="btn tooltipped tooltipped-ne px-2" | ||
| className="btn tooltipped tooltipped-se px-2" |
| // Only request it later to avoid slowing down the page load | ||
| if (await isUrlReachable(url.href)) { | ||
| defaultLink.classList.add('disabled'); | ||
| defaultLink.setAttribute('aria-label', 'Object not found on the default branch'); |
Member
There was a problem hiding this comment.
Moved logic down here. The object can be missing not he default branch even if the current page exists. For example:
fregante
reviewed
Aug 24, 2023
Comment on lines
+195
to
+196
| link.className = description.className; | ||
| link.style.display = 'inline'; |
Member
Contributor
Author
fregante
enabled auto-merge (squash)
August 28, 2023 09:27
fregante
disabled auto-merge
August 28, 2023 09:27
useful-not-found-page to the new "404 file" pageuseful-not-found-page on the new "404 file" page
fregante
enabled auto-merge (squash)
August 28, 2023 09:28
Member
|
Thank you! |
Member
jerone
reviewed
Sep 8, 2023
| // Commit lists for files and folders lack a branch selector | ||
| export const isRepoCommitListRoot = (): boolean => pageDetect.isRepoCommitList() && document.title.startsWith('Commits'); | ||
|
|
||
| export const isUrlReachable = mem(async (url: string): Promise<boolean> => { |
Contributor
There was a problem hiding this comment.
Suggested change
| export const isUrlReachable = mem(async (url: string): Promise<boolean> => { | |
| export const isUrlUnreachable = mem(async (url: string): Promise<boolean> => { |
😉
Member
There was a problem hiding this comment.
It looks like I made a couple of mistakes when renaming:
- I meant to change the 404 check to just use
response.ok - I forgot to flip every condition to actually match "is reachable", to avoid double negations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Description
useful-not-found-pagebroken on new 404 repo page #6413As @fregante said on #6413 (comment)
Test URLs
Screenshot