Disconnecting, cancelling and (when a key already exists) connecting now swap the Nostr Connect section via Turbo Streams, so the page's relay/profile/media lookups are not re-fetched. A replace still reloads because it changes the key, and a first-time connect reloads to reveal the pubkey and metadata.
13 lines
452 B
JavaScript
13 lines
452 B
JavaScript
import { Controller } from "@hotwired/stimulus"
|
|
|
|
// Mirrors the signer section's connection state onto the document, so the
|
|
// `data-remote-signer` flag stays correct when the section is replaced in place
|
|
// (turbo stream) instead of via a full page load.
|
|
export default class extends Controller {
|
|
static values = { connected: Boolean }
|
|
|
|
connect () {
|
|
document.documentElement.dataset.remoteSigner = this.connectedValue ? "true" : "false"
|
|
}
|
|
}
|