Skip to content

Events/Edit.vue silently discards invalid JSON in Payload/Schema fields — independent instance of #98's bug #151

Description

@morcen

What: Events/Edit.vue has its own watch handlers that parse the Payload/Schema textareas and silently swallow parse errors:

watch(payloadText, (val) => {
    try { form.payload = val ? JSON.parse(val) : null } catch {}
})
watch(schemaText, (val) => {
    try { form.schema = val ? JSON.parse(val) : null } catch {}
})

Where: resources/js/Pages/Events/Edit.vue:131-137 (watchers), 139-143 (save() submits form.payload/form.schema as-is)

Why it matters: If a user types invalid JSON, form.payload/form.schema silently keep their last-valid value while the textarea visibly shows the broken JSON the user typed. save() then submits the stale (pre-edit) data with no indication anything was wrong — the user believes their edit was saved when it wasn't. This is the same underlying defect already tracked in #98 for Events/Index.vue's inline edit modal, but it exists independently here in a separate routed page (/events/{event}/edit) with its own duplicate watchers — fixing #98 in Index.vue will not fix this page.

Suggested fix: Surface a validation error from the parse catch block (e.g. set form.errors.payload/form.errors.schema) and/or disable the Save button while the JSON is invalid, applied to both this page and the Index.vue modal covered by #98.

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