Skip to content

Enable useful-not-found-page on the new "404 file" page - #6840

Merged
fregante merged 32 commits into
refined-github:mainfrom
134130:fix/#6413
Aug 28, 2023
Merged

fregante merged 32 commits into
refined-github:mainfrom
134130:fix/#6413

Conversation

@134130

@134130 134130 commented Aug 18, 2023

Copy link
Copy Markdown
Contributor

@134130 134130 changed the title Feat: check default branch Enhance useful-not-found-page Aug 18, 2023
Comment thread source/features/toggle-files-button.tsx Resolved

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM so far. I'll see how it looks

@fregante fregante changed the title Enhance useful-not-found-page Add useful-not-found-page to the new "404 file" page Aug 19, 2023

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be good. Review?

const defaultLink = (
<a
className="btn tooltipped tooltipped-ne px-2"
className="btn tooltipped tooltipped-se px-2"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Before:

Screenshot 6

After:

Screenshot 7

// 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');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment on lines +195 to +196
link.className = description.className;
link.style.display = 'inline';

@fregante fregante Aug 24, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Their DOM sucks, what a dumpster fire:

Screenshot 9

Let's just use utility classes:

Suggested change
link.className = description.className;
link.style.display = 'inline';
link.className = 'color-fg-muted';

@134130 134130 Aug 27, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤔 How can we avoid this CLS issue? use skeleton?
화면 기록 2023-08-27 23 47 12

@fregante
fregante enabled auto-merge (squash) August 28, 2023 09:27
@fregante
fregante disabled auto-merge August 28, 2023 09:27
@fregante fregante changed the title Add useful-not-found-page to the new "404 file" page Enable useful-not-found-page on the new "404 file" page Aug 28, 2023
@fregante
fregante enabled auto-merge (squash) August 28, 2023 09:28
@fregante
fregante merged commit aa9d746 into refined-github:main Aug 28, 2023
@fregante

Copy link
Copy Markdown
Member

Thank you!

@fregante

Copy link
Copy Markdown
Member

🤔 How can we avoid this CLS issue? use skeleton?

Skeletons are hard to maintain and the text will still wrap on mobile, causing extra space.

I'd rather just move the text below the green button or drop the button altogether since it's a super-duplicate button

Screenshot 7

(orange slash = duplicate only when already on the main branch)

// 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> => {

@jerone jerone Sep 8, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const isUrlReachable = mem(async (url: string): Promise<boolean> => {
export const isUrlUnreachable = mem(async (url: string): Promise<boolean> => {

😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🥹

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

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

Development

Successfully merging this pull request may close these issues.

useful-not-found-page broken on new 404 repo page

4 participants