perf: prefetch all internal links (#981)

This commit is contained in:
Nolan Lawson 2019-02-13 18:40:02 -08:00 committed by GitHub
parent 58d1f62b2b
commit df09b0a995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 25 additions and 13 deletions

View File

@ -2,6 +2,7 @@
aria-label={ariaLabel} aria-label={ariaLabel}
aria-current={selected} aria-current={selected}
on:click="onClick(event)" on:click="onClick(event)"
rel="prefetch"
{href} > {href} >
<div class="nav-icon-and-label"> <div class="nav-icon-and-label">
{#if name === 'notifications'} {#if name === 'notifications'}

View File

@ -11,7 +11,7 @@
<p>Read the <ExternalLink href="https://nolanlawson.com/2018/04/09/introducing-pinafore-for-mastodon/">introductory blog post</ExternalLink>, or get started by logging in to an instance:</p> <p>Read the <ExternalLink href="https://nolanlawson.com/2018/04/09/introducing-pinafore-for-mastodon/">introductory blog post</ExternalLink>, or get started by logging in to an instance:</p>
<p style="text-align: right;"><a class="button primary" href="/settings/instances/add">Add instance</a></p> <p style="text-align: right;"><a class="button primary" rel="prefetch" href="/settings/instances/add">Add instance</a></p>
</div> </div>
</FreeTextLayout> </FreeTextLayout>
</HiddenFromSSR> </HiddenFromSSR>

View File

@ -1,5 +1,5 @@
<li class="page-list-item"> <li class="page-list-item">
<a {href}> <a {href} rel="prefetch">
<svg class="page-list-item-svg"> <svg class="page-list-item-svg">
<use xlink:href={icon} /> <use xlink:href={icon} />
</svg> </svg>

View File

@ -1,9 +1,10 @@
<a href="/accounts/{verifyCredentials.id}" <a href="/accounts/{verifyCredentials.id}"
rel="prefetch"
class="compose-box-avatar" class="compose-box-avatar"
aria-label="Profile for {accessibleName}"> aria-label="Profile for {accessibleName}">
<Avatar account={verifyCredentials} size="small"/> <Avatar account={verifyCredentials} size="small"/>
</a> </a>
<a class="compose-box-display-name" href="/accounts/{verifyCredentials.id}"> <a class="compose-box-display-name" href="/accounts/{verifyCredentials.id}" rel="prefetch">
<AccountDisplayName account={verifyCredentials} /> <AccountDisplayName account={verifyCredentials} />
</a> </a>
<span class="compose-box-handle"> <span class="compose-box-handle">
@ -72,4 +73,4 @@
} }
} }
} }
</script> </script>

View File

@ -11,6 +11,7 @@
<a class="account-profile-details-item" <a class="account-profile-details-item"
href='/accounts/{account.id}/follows' href='/accounts/{account.id}/follows'
aria-label={followingLabel} aria-label={followingLabel}
rel="prefetch"
> >
<span class="account-profile-details-item-title"> <span class="account-profile-details-item-title">
Follows Follows
@ -22,6 +23,7 @@
<a class="account-profile-details-item" <a class="account-profile-details-item"
href='/accounts/{account.id}/followers' href='/accounts/{account.id}/followers'
aria-label={followersLabel} aria-label={followersLabel}
rel="prefetch"
> >
<span class="account-profile-details-item-title"> <span class="account-profile-details-item-title">
Followers Followers

View File

@ -1,5 +1,5 @@
<li class="search-result"> <li class="search-result">
<a {href} class="search-result-anchor"> <a {href} class="search-result-anchor" rel="prefetch">
<slot></slot> <slot></slot>
</a> </a>
</li> </li>
@ -33,4 +33,4 @@
padding: 15px 10px; padding: 15px 10px;
} }
} }
</style> </style>

View File

@ -1,4 +1,4 @@
<a {href} aria-label={ariaLabel || label} class="settings-list-button {className ? className : ''}"> <a {href} rel="prefetch" aria-label={ariaLabel || label} class="settings-list-button {className ? className : ''}">
<span> <span>
{label} {label}
</span> </span>

View File

@ -1,5 +1,6 @@
<a class="settings-nav-item {className}" <a class="settings-nav-item {className}"
aria-label={ariaLabel} aria-label={ariaLabel}
rel="prefetch"
{href} > {href} >
{label} {label}
</a> </a>
@ -19,4 +20,4 @@
ariaLabel: ({ page, name, label }) => page === name ? `${label} (current page)` : label ariaLabel: ({ page, name, label }) => page === name ? `${label} (current page)` : label
} }
} }
</script> </script>

View File

@ -1,4 +1,5 @@
<a class="status-author-name {isStatusInNotification ? 'status-in-notification' : '' } {isStatusInOwnThread ? 'status-in-own-thread' : ''}" <a class="status-author-name {isStatusInNotification ? 'status-in-notification' : '' } {isStatusInOwnThread ? 'status-in-own-thread' : ''}"
rel="prefetch"
href="/accounts/{originalAccountId}" href="/accounts/{originalAccountId}"
title="{'@' + originalAccount.acct}" title="{'@' + originalAccount.acct}"
focus-key={focusKey} focus-key={focusKey}
@ -44,4 +45,4 @@
AccountDisplayName AccountDisplayName
} }
} }
</script> </script>

View File

@ -25,6 +25,7 @@
{/if} {/if}
{/if} {/if}
<a class="status-favs-reblogs status-reblogs" <a class="status-favs-reblogs status-reblogs"
rel="prefetch"
href="/statuses/{originalStatusId}/reblogs" href="/statuses/{originalStatusId}/reblogs"
aria-label={reblogsLabel}> aria-label={reblogsLabel}>
<svg class="status-favs-reblogs-svg"> <svg class="status-favs-reblogs-svg">
@ -33,6 +34,7 @@
<span>{numReblogs}</span> <span>{numReblogs}</span>
</a> </a>
<a class="status-favs-reblogs status-favs" <a class="status-favs-reblogs status-favs"
rel="prefetch"
href="/statuses/{originalStatusId}/favorites" href="/statuses/{originalStatusId}/favorites"
aria-label={favoritesLabel}> aria-label={favoritesLabel}>
<svg class="status-favs-reblogs-svg"> <svg class="status-favs-reblogs-svg">

View File

@ -13,6 +13,7 @@
</span> </span>
{:else} {:else}
<a href="/accounts/{accountId}" <a href="/accounts/{accountId}"
rel="prefetch"
class="status-header-author" class="status-header-author"
title="{'@' + account.acct}" title="{'@' + account.acct}"
focus-key={focusKey} > focus-key={focusKey} >
@ -124,4 +125,4 @@
} }
} }
} }
</script> </script>

View File

@ -8,6 +8,7 @@
<!-- empty space --> <!-- empty space -->
{/if} {/if}
<a href="/accounts/{mention.id}" <a href="/accounts/{mention.id}"
rel="prefetch"
title="@{mention.acct}" title="@{mention.acct}"
focus-key="status-mention-link-{uuid}-{mention.id}"> focus-key="status-mention-link-{uuid}-{mention.id}">
@{mention.username} @{mention.username}

View File

@ -1,5 +1,6 @@
<a class="status-relative-date {isStatusInNotification ? 'status-in-notification' : '' }" <a class="status-relative-date {isStatusInNotification ? 'status-in-notification' : '' }"
href="/statuses/{originalStatusId}" href="/statuses/{originalStatusId}"
rel="prefetch"
focus-key={focusKey} focus-key={focusKey}
> >
<time datetime={createdAtDate} title={absoluteFormattedDate} <time datetime={createdAtDate} title={absoluteFormattedDate}

View File

@ -1,4 +1,5 @@
<a class="status-sidebar size-{size}" <a class="status-sidebar size-{size}"
rel="prefetch"
href="/accounts/{originalAccountId}" href="/accounts/{originalAccountId}"
focus-key={focusKey} focus-key={focusKey}
aria-hidden="true" aria-hidden="true"
@ -40,4 +41,4 @@
size: ({ isStatusInOwnThread }) => isStatusInOwnThread ? 'medium' : 'small' size: ({ isStatusInOwnThread }) => isStatusInOwnThread ? 'medium' : 'small'
} }
} }
</script> </script>

View File

@ -24,10 +24,10 @@
</SettingsListRow> </SettingsListRow>
{/each} {/each}
</SettingsList> </SettingsList>
<p><a href="/settings/instances/add">Add another instance</a></p> <p><a rel="prefetch" href="/settings/instances/add">Add another instance</a></p>
{:else} {:else}
<p>You're not logged in to any instances.</p> <p>You're not logged in to any instances.</p>
<p><a href="/settings/instances/add">Log in to an instance</a> to start using Pinafore.</p> <p><a rel="prefetch" href="/settings/instances/add">Log in to an instance</a> to start using Pinafore.</p>
{/if} {/if}
</SettingsLayout> </SettingsLayout>
<style> <style>