Skip to content

Commit

Permalink
fix anchor navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
rafapaezbas committed Mar 7, 2024
1 parent 9c1d16c commit 79892df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion building-blocks/hyperdrive.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Notable features include:

* Uses Hyperbee internally for storing file metadata
* Major API simplification. Instead of mirroring POSIX APIs, the new API better captures the core requirements of P2P file transfer.
* Auxiliary tools, [`localdrive`](./helpers/localdrive.md) and [`mirrordrive`](./helpers/mirrordrive.md), that streamline import/export flows and make it easy to mirror drives to and from the local filesystem.
* Auxiliary tools, [`localdrive`](../helpers/localdrive.md) and [`mirrordrive`](../helpers/mirrordrive.md), that streamline import/export flows and make it easy to mirror drives to and from the local filesystem.

> [GitHub (Hyperdrive)](https://github.com/holepunchto/hyperdrive)
Expand Down
4 changes: 3 additions & 1 deletion lib/app-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ customElements.define('app-router', class AppRouter extends HTMLElement {
super()
this.routes = {}
this.page = null
this.anchor = null
}

unload () {
for (const element of Object.values(this.routes)) element?.unload && element.unload()
}

async load (pathname = '/', opts = {}) {
if (this.page === pathname) return
if (this.page === pathname && this.anchor === opts.anchor) return
this.page = pathname
this.anchor = opts.anchor
for (const [route, element] of Object.entries(this.routes)) {
if (pathname.startsWith(route)) {
const page = pathname.slice(route.length) || '/'
Expand Down

0 comments on commit 79892df

Please sign in to comment.