~james/core

core/web/src/lib/components/ui/StaleReload.svelte -rw-r--r-- 605 bytes
452f17b7 — james chore(import): snapshot james.dad.town/core at f70c71c7696a 15 hours ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<script lang="ts">
	import { StaleEditError } from "#lib/api/cob.ts";
	import Button from "#lib/components/ui/Button.svelte";
	import ErrorAlert from "#lib/components/ui/Error.svelte";

	// forms that already show the action's error leave the message off
	let { cause, message = false }: { cause: unknown; message?: boolean } = $props();
</script>

{#if cause instanceof StaleEditError}
	{#if message}
		<ErrorAlert label={cause.message} />
	{/if}
	<div data-testid="staleEdit" class="flex justify-end">
		<Button type="button" size="small" onclick={() => location.reload()}>Reload</Button>
	</div>
{/if}