Possible fix for sign in with apple migrations failing

This commit is contained in:
George Powell
2026-02-18 17:54:01 -05:00
parent c50cccd3d3
commit e8b2d2e35e
6 changed files with 153 additions and 17 deletions

View File

@@ -2,6 +2,30 @@
import { browser } from "$app/environment";
import Button from "$lib/components/Button.svelte";
let { anonymousId }: { anonymousId: string | null } = $props();
let seeding = $state(false);
async function seedHistory() {
if (!browser || !anonymousId || seeding) return;
seeding = true;
try {
const response = await fetch("/api/dev/seed-history", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ anonymousId })
});
const result = await response.json();
alert(
`Seeded! Inserted: ${result.inserted?.join(", ")}. Skipped (already exist): ${result.skipped?.join(", ") || "none"}`
);
} catch {
alert("Failed to seed history");
} finally {
seeding = false;
}
}
function clearLocalStorage() {
if (!browser) return;
// Clear all bibdle-related localStorage items
@@ -86,4 +110,13 @@
>
Clear LocalStorage
</Button>
<Button
variant="secondary"
onclick={seedHistory}
disabled={seeding}
class="w-full py-4 md:py-2"
>
{seeding ? "Seeding..." : "Seed 10 Days of History"}
</Button>
</div>