From 9e80dfbb51c5700ee276275effffb0ff31f8fef7 Mon Sep 17 00:00:00 2001 From: flavio-b Date: Sun, 15 Sep 2024 18:03:33 -0700 Subject: [PATCH 1/2] Correct event.detail properties of `turbo:submit-end` Clarified fetchResponse behavior: Now reflects that fetchResponse can be present even when success: false (e.g., for 4xx or 5xx server errors), and it is only undefined when the fetch itself fails. Updated error property description: Specifies that error is undefined by default and is only set when a fetch error occurs (e.g., network issues). --- _source/reference/events.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/_source/reference/events.md b/_source/reference/events.md index c66bf58..b277e37 100644 --- a/_source/reference/events.md +++ b/_source/reference/events.md @@ -155,12 +155,12 @@ Fires during a form submission. Access the [FormSubmission][] object with `event Fires after the form submission-initiated network request completes. Access the [FormSubmission][] object with `event.detail.formSubmission` along with the properties included within `event.detail`. -| `event.detail` property | Type | Description -|---------------------------|-------------------------------|------------ -| `formSubmission` | [FormSubmission][] | the `
` element submission -| `success` | `boolean` | a `boolean` representing the request's success -| `fetchResponse` | [FetchResponse][] \| `null` | present when `success: true`, `null` when `success: false` -| `error` | [Error][] or `null` | `null` when `success: true`, present when `success: false` +| `event.detail` property | Type | Description +|---------------------------|----------------------------------|------------ +| `formSubmission` | [FormSubmission][] | The `` element submission. +| `success` | `boolean` | A `boolean` representing the request's success. +| `fetchResponse` | [FetchResponse][] \| `undefined` | Present when a response is received, even if `success: false`. Undefined if the request errored before a response was received. +| `error` | [Error][] \| `undefined` | Undefined unless an actual fetch error occurs (e.g., network issues). [Error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors [FormSubmission]: /reference/drive#formsubmission From 4bfe25df0349a7214b0fbd89a1c750331406bda2 Mon Sep 17 00:00:00 2001 From: flavio-b Date: Mon, 16 Sep 2024 00:03:17 -0700 Subject: [PATCH 2/2] Slightly amend style to match the other tables Start description in small caps and remove the period (.) from the end. (Previously commit added these by mistake). --- _source/reference/events.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/_source/reference/events.md b/_source/reference/events.md index b277e37..23bc750 100644 --- a/_source/reference/events.md +++ b/_source/reference/events.md @@ -157,10 +157,10 @@ Fires after the form submission-initiated network request completes. Access the | `event.detail` property | Type | Description |---------------------------|----------------------------------|------------ -| `formSubmission` | [FormSubmission][] | The `` element submission. -| `success` | `boolean` | A `boolean` representing the request's success. -| `fetchResponse` | [FetchResponse][] \| `undefined` | Present when a response is received, even if `success: false`. Undefined if the request errored before a response was received. -| `error` | [Error][] \| `undefined` | Undefined unless an actual fetch error occurs (e.g., network issues). +| `formSubmission` | [FormSubmission][] | the `` element submission +| `success` | `boolean` | a `boolean` representing the request's success +| `fetchResponse` | [FetchResponse][] \| `undefined` | present when a response is received, even if `success: false`. `undefined` if the request errored before a response was received +| `error` | [Error][] \| `undefined` | `undefined` unless an actual fetch error occurs (e.g., network issues) [Error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors [FormSubmission]: /reference/drive#formsubmission