mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Handle fallback for component already initialized
This commit is contained in:
parent
c9ae2ac436
commit
7d176decfc
@ -12,13 +12,24 @@ let initialized = false;
|
|||||||
|
|
||||||
export async function initializeBitcoinConnect() {
|
export async function initializeBitcoinConnect() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
const { init } = await import('@getalby/bitcoin-connect-react');
|
try {
|
||||||
init({
|
const { init } = await import('@getalby/bitcoin-connect-react');
|
||||||
appName: "PlebDevs",
|
// Check if custom elements are already registered
|
||||||
filters: ["nwc"],
|
if (!customElements.get('bc-balance')) {
|
||||||
showBalance: false
|
init({
|
||||||
});
|
appName: "PlebDevs",
|
||||||
initialized = true;
|
filters: ["nwc"],
|
||||||
|
showBalance: false
|
||||||
|
});
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// If the error is about custom element already being defined, we can ignore it
|
||||||
|
// as it means the component is already initialized
|
||||||
|
if (!error.message?.includes('has already been defined as a custom element')) {
|
||||||
|
console.error('Error initializing Bitcoin Connect:', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user