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
|
// Show loading spinner during home page initialization
|
||||||
showHomeLoadingSpinner('Initializing pairing interface...');
|
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();
|
initIframePairing();
|
||||||
initContentMenu();
|
initContentMenu();
|
||||||
initIframeCommunication();
|
initIframeCommunication();
|
||||||
|
}
|
||||||
|
|
||||||
// Set up iframe pairing button listeners
|
// Set up iframe pairing button listeners
|
||||||
setupIframePairingButtons();
|
setupIframePairingButtons();
|
||||||
|
|||||||
@ -829,22 +829,25 @@ export default class Services {
|
|||||||
publicData: Record<string, any>,
|
publicData: Record<string, any>,
|
||||||
roles: Record<string, RoleDefinition>
|
roles: Record<string, RoleDefinition>
|
||||||
): Promise<ApiReturn> {
|
): Promise<ApiReturn> {
|
||||||
let relayAddress = this.getAllRelays()[0]?.spAddress;
|
// Attendre que le relai soit prêt avec son spAddress
|
||||||
|
|
||||||
if (!relayAddress) {
|
|
||||||
console.log('⏳ Waiting for relays to be ready...');
|
console.log('⏳ Waiting for relays to be ready...');
|
||||||
// Update UI status
|
// Update UI status
|
||||||
const { updateCreatorStatus } = await import('../utils/sp-address.utils');
|
const { updateCreatorStatus } = await import('../utils/sp-address.utils');
|
||||||
updateCreatorStatus('⏳ Waiting for relays to be ready...');
|
updateCreatorStatus('⏳ Waiting for relays to be ready...');
|
||||||
|
|
||||||
await this.getRelayReadyPromise();
|
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) {
|
if (!relayAddress) {
|
||||||
|
console.error('Available relays:', relays);
|
||||||
throw new Error('❌ No relay address available after waiting');
|
throw new Error('❌ No relay address available after waiting');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('✅ Relay address found:', relayAddress);
|
||||||
|
|
||||||
const feeRate = 1;
|
const feeRate = 1;
|
||||||
|
|
||||||
// We can't encode files as the rest because Uint8Array is not valid json
|
// We can't encode files as the rest because Uint8Array is not valid json
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user