fix: Improve relay readiness logic and prevent iframe initialization in full page
**Motivations :** - Fix 'Waiting for relays to be ready...' issue by properly waiting for relay spAddress - Prevent unnecessary iframe creation when application runs in full page mode - Improve relay address validation logic **Modifications :** - Enhanced createProcess to properly wait for relay spAddress before proceeding - Added better relay address validation with non-empty string check - Conditional iframe initialization only when running in iframe context - Added debug logging for available relays when address not found **Pages affectées :** - src/services/service.ts - Relay readiness logic - src/pages/home/home.ts - Conditional iframe initialization
This commit is contained in:
parent
97427e811a
commit
bec3ab1729
@ -108,10 +108,12 @@ export async function initHomePage(): Promise<void> {
|
||||
// Show loading spinner during home page initialization
|
||||
showHomeLoadingSpinner('Initializing pairing interface...');
|
||||
|
||||
// Initialize iframe pairing, content menu, and communication
|
||||
// Initialize iframe pairing, content menu, and communication only if in iframe
|
||||
if (window.parent !== window) {
|
||||
initIframePairing();
|
||||
initContentMenu();
|
||||
initIframeCommunication();
|
||||
}
|
||||
|
||||
// Set up iframe pairing button listeners
|
||||
setupIframePairingButtons();
|
||||
|
||||
@ -829,22 +829,25 @@ export default class Services {
|
||||
publicData: Record<string, any>,
|
||||
roles: Record<string, RoleDefinition>
|
||||
): Promise<ApiReturn> {
|
||||
let relayAddress = this.getAllRelays()[0]?.spAddress;
|
||||
|
||||
if (!relayAddress) {
|
||||
// Attendre que le relai soit prêt avec son spAddress
|
||||
console.log('⏳ Waiting for relays to be ready...');
|
||||
// Update UI status
|
||||
const { updateCreatorStatus } = await import('../utils/sp-address.utils');
|
||||
updateCreatorStatus('⏳ Waiting for relays to be ready...');
|
||||
|
||||
await this.getRelayReadyPromise();
|
||||
relayAddress = this.getAllRelays()[0]?.spAddress;
|
||||
}
|
||||
|
||||
// Vérifier que nous avons maintenant un spAddress
|
||||
const relays = this.getAllRelays();
|
||||
const relayAddress = relays.find(relay => relay.spAddress && relay.spAddress.trim() !== '')?.spAddress;
|
||||
|
||||
if (!relayAddress) {
|
||||
console.error('Available relays:', relays);
|
||||
throw new Error('❌ No relay address available after waiting');
|
||||
}
|
||||
|
||||
console.log('✅ Relay address found:', relayAddress);
|
||||
|
||||
const feeRate = 1;
|
||||
|
||||
// We can't encode files as the rest because Uint8Array is not valid json
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user