|
135 | 135 | { value: "pending", checked: false },
|
136 | 136 | ];
|
137 | 137 |
|
138 |
| - let initializationAttempted = false; |
| 138 | + let litInitializationAttempted = false; |
139 | 139 |
|
140 | 140 | // Track initialization state
|
141 | 141 | let initialized = false;
|
|
227 | 227 | await initializeLitSession(currentAccount);
|
228 | 228 | } else {
|
229 | 229 | console.log("Skipping Lit initialization as decryption is off");
|
230 |
| - initializationAttempted = true; |
| 230 | + litInitializationAttempted = true; |
231 | 231 | }
|
232 | 232 |
|
233 | 233 | console.log("Fetching requests");
|
|
288 | 288 | }
|
289 | 289 |
|
290 | 290 | // Reset state for new account
|
291 |
| - initializationAttempted = false; |
| 291 | + litInitializationAttempted = false; |
292 | 292 | initialized = false;
|
293 | 293 | previousAddress = undefined;
|
294 | 294 | clearLitStorage();
|
|
352 | 352 | previousAddress = currentAccount.address;
|
353 | 353 |
|
354 | 354 | // Skip Lit initialization if decryption is off
|
355 |
| - if (sliderValueForDecryption === "on" && !initializationAttempted) { |
| 355 | + if (sliderValueForDecryption === "on" && !litInitializationAttempted) { |
356 | 356 | await initializeLitSession(currentAccount);
|
357 | 357 | }
|
358 | 358 |
|
|
446 | 446 | const initializeLitSession = async (
|
447 | 447 | currentAccount: GetAccountReturnType | undefined
|
448 | 448 | ) => {
|
449 |
| - if (!currentAccount?.address || !cipherProvider || initializationAttempted) { |
| 449 | + if (!currentAccount?.address || !cipherProvider || litInitializationAttempted) { |
450 | 450 | console.error(
|
451 | 451 | "Initialization skipped: Missing account, cipherProvider, or already attempted."
|
452 | 452 | );
|
453 | 453 | return;
|
454 | 454 | }
|
455 | 455 |
|
456 |
| - initializationAttempted = true; |
| 456 | + litInitializationAttempted = true; |
457 | 457 |
|
458 | 458 | try {
|
459 | 459 | const storedSig = localStorage?.getItem("lit-wallet-sig");
|
|
919 | 919 | console.log("Current state:", {
|
920 | 920 | address: account?.address,
|
921 | 921 | initialized,
|
922 |
| - initializationAttempted, |
| 922 | + litInitializationAttempted, |
923 | 923 | hasRequests: requests?.length > 0,
|
924 | 924 | isLoading: loading,
|
925 | 925 | decryptionEnabled: sliderValueForDecryption === "on"
|
|
0 commit comments