refactor(idaa): rename reload_to_origin → reload_with_uuid (clearer intent)
'origin' is a reserved web term (protocol+domain); the function restores the initial Novi-provided iframe URL (which includes the ?uuid= param), not the site root. Renamed to reload_with_uuid to make that clear. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -88,10 +88,10 @@ onMount(() => {
|
||||
}
|
||||
});
|
||||
|
||||
function reload_to_origin() {
|
||||
const origin_url = sessionStorage.getItem(IDAA_IFRAME_RELOAD_URL_KEY);
|
||||
if (origin_url && origin_url !== location.href) {
|
||||
location.href = origin_url;
|
||||
function reload_with_uuid() {
|
||||
const initial_url = sessionStorage.getItem(IDAA_IFRAME_RELOAD_URL_KEY);
|
||||
if (initial_url && initial_url !== location.href) {
|
||||
location.href = initial_url;
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
@@ -498,7 +498,7 @@ function handle_verify_retry() {
|
||||
db_archives.archive.clear().catch(() => {});
|
||||
db_archives.content.clear().catch(() => {});
|
||||
db_events.event.clear().catch(() => {});
|
||||
reload_to_origin();
|
||||
reload_with_uuid();
|
||||
}}>
|
||||
<span class="fas fa-redo m-1"></span>
|
||||
Reset & Retry
|
||||
@@ -550,7 +550,7 @@ function handle_verify_retry() {
|
||||
db_archives.archive.clear().catch(() => {});
|
||||
db_archives.content.clear().catch(() => {});
|
||||
db_events.event.clear().catch(() => {});
|
||||
reload_to_origin();
|
||||
reload_with_uuid();
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-surface preset-outlined-warning-100-900 hover:preset-filled-warning-200-800 transition-all">
|
||||
<span class="fas fa-sync-alt m-1"></span>
|
||||
@@ -567,7 +567,7 @@ function handle_verify_retry() {
|
||||
}
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
// sessionStorage was just cleared, so reload_to_origin() falls back to
|
||||
// sessionStorage was just cleared, so reload_with_uuid() falls back to
|
||||
// location.reload() — that's correct since this is a full wipe.
|
||||
location.reload();
|
||||
}}
|
||||
@@ -613,7 +613,7 @@ function handle_verify_retry() {
|
||||
(2) Timing race on first load — UUID arrives but $ae_loc not yet populated.
|
||||
(3) $ae_loc reset while $idaa_loc TTL cache was still valid (fixed via TTL+perms check).
|
||||
In iframe context the UUID is only on the initial Novi-provided URL, not on
|
||||
subsequent SvelteKit client-side navigations — reload_to_origin() restores it. -->
|
||||
subsequent SvelteKit client-side navigations — reload_with_uuid() restores it. -->
|
||||
<div
|
||||
class="container m-8 flex w-full flex-col items-center justify-center gap-3 p-8 text-center">
|
||||
<h1 class="font-bold">
|
||||
@@ -632,13 +632,13 @@ function handle_verify_retry() {
|
||||
</p>
|
||||
<div class="flex flex-row flex-wrap items-center justify-center gap-2">
|
||||
<!-- WHY: In iframe mode the Novi UUID is passed via URL param on first load.
|
||||
If verification was a timing race the user lands here. reload_to_origin()
|
||||
If verification was a timing race the user lands here. reload_with_uuid()
|
||||
restores the original URL (with UUID) — plain location.reload() would
|
||||
reload the current SvelteKit path which may not have the UUID. -->
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm preset-tonal-primary border-primary-500 border"
|
||||
onclick={reload_to_origin}>
|
||||
onclick={reload_with_uuid}>
|
||||
<span class="fas fa-redo m-1"></span>
|
||||
Reload / Retry
|
||||
</button>
|
||||
@@ -651,7 +651,7 @@ function handle_verify_retry() {
|
||||
db_archives.archive.clear().catch(() => {});
|
||||
db_archives.content.clear().catch(() => {});
|
||||
db_events.event.clear().catch(() => {});
|
||||
reload_to_origin();
|
||||
reload_with_uuid();
|
||||
}}
|
||||
class="btn btn-sm preset-tonal-surface preset-outlined-warning-100-900 hover:preset-filled-warning-200-800 transition-all">
|
||||
<span class="fas fa-sync-alt m-1"></span>
|
||||
|
||||
Reference in New Issue
Block a user