Skip to content

Test form remote functions #13

@kevmodrome

Description

@kevmodrome

I've noticed Claude Opus 4.5 regularly decides to write it's own handlers for the form remote function.

Here's an example of code it writes (removed irrelevant parts):

<script lang="ts">
	import { approveJob } from './content.remote'

	let approving = $state(false)

	async function handleApprove() {
		if (approving) return
		approving = true
		try {
			const result = await approveJob({ id: contentId })
			if (result?.success) {
				toast.success('Job approved and employer notified!')
				// Reload the page to show updated status
				window.location.reload()
			} else {
				toast.error('Failed to approve job')
			}
		} catch {
			toast.error('Failed to approve job')
		} finally {
			approving = false
		}
	}
</script>

<Button onclick={handleApprove} variant="primary" disabled={approving}>
	{approving ? 'Approving...' : 'Approve & Notify Employer'}
</Button>
{/if}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions