Skip to content

Invalid JSON in Event Payload/Schema textareas is silently discarded; edits appear to save but the stale value is submitted instead #98

Description

@morcen

What's wrong

resources/js/Pages/Events/Index.vue:435-449 (create/duplicate modal) watches the raw textarea text and tries to parse it:

watch(payloadText, (newValue) => {
    try {
        form.payload = newValue ? JSON.parse(newValue) : null
    } catch (e) {
        // Invalid JSON - will be handled by backend validation
    }
})

(same pattern for form.schema). When JSON.parse throws, the catch block does nothing — form.payload/form.schema simply retain their last-successfully-parsed value. The comment's claim that "backend validation" will handle it is false: the invalid text is never sent anywhere, so the backend never sees it and never has a chance to reject it.

Update (2026-09-13): the equivalent bug in resources/js/Pages/Events/Edit.vue was fixed in #223 (commit 67ab73c), which now tracks payloadJsonError/schemaJsonError, surfaces them via InputError, and blocks save() while either field is invalid. That fix only touched Edit.vue — the create/duplicate modal in Index.vue still has the original silent-catch bug described above. This issue is now scoped to Index.vue only.

Repro

  1. Open the "Create Event" (or "Duplicate Event") modal on the Events index page.
  2. Type a Payload or Schema value with invalid JSON (e.g. missing a closing }).
  3. Click "Save". form.payload/form.schema still holds the last successfully-parsed value from before the typo, since the watcher never updated it.
  4. The request submits successfully (200), the UI reports success — but the stored payload/schema doesn't reflect what was actually typed. The user's input is silently dropped with no error message explaining why.

This is distinct from the already-tracked issue about malformed schemas causing a 500 at trigger time (#55) — this is about edits never reaching the server at all, despite an apparent success.

Why it matters

Silent data loss with a false "success" signal is a serious UX/data-integrity problem — users have no way to know their input didn't take effect.

Suggested fix

Apply the same fix #223 already applied to Edit.vue: track parse failures in local reactive state (e.g. payloadJsonError), display it inline via InputError, and block save while the JSON is invalid, instead of silently falling back to stale data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions