You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble understanding what kind of response to return from requests that handle Precognition requests. All the Precog functionality works just fine, what I don't understand is what the request should return after saving the form submission. Ideally, I just want to return a 200 OK status so that the onSuccess handler does what it should do which is emit an event that the parent component is listening for then I want that component to do a partial reload of the page by only loading the comments (the controller is already set up to allow for optionally loading particular properties).
The problem I run into is that Inertia expects an Inertia response from the form request otherwise it pops open an error message window. So what kind of response should I return so that I am not rendering a page or performing a redirect that causes the entire page to reload? It does seem like the onSuccess callback is executing but I get a full page reload from the parent component even if I comment out the one line that appears in the onCommentPosted handler (see below). And that is probably because I am currently returning a redirect response just to avoid getting the error message about returning an invalid Inertia response.
Is there a way to return an Inertia response that is nothing more than empty JSON or just an empty response with a 200 status?
Composer Package Versions
Laravel 12.3.0
Inertia 2.0.1
package.json
laravel-precognition-vue-inertia 0.7.1
Description of Problem
I am having trouble understanding what kind of response to return from requests that handle Precognition requests. All the Precog functionality works just fine, what I don't understand is what the request should return after saving the form submission. Ideally, I just want to return a 200 OK status so that the onSuccess handler does what it should do which is emit an event that the parent component is listening for then I want that component to do a partial reload of the page by only loading the comments (the controller is already set up to allow for optionally loading particular properties).
The problem I run into is that Inertia expects an Inertia response from the form request otherwise it pops open an error message window. So what kind of response should I return so that I am not rendering a page or performing a redirect that causes the entire page to reload? It does seem like the
onSuccess
callback is executing but I get a full page reload from the parent component even if I comment out the one line that appears in theonCommentPosted
handler (see below). And that is probably because I am currently returning a redirect response just to avoid getting the error message about returning an invalid Inertia response.Is there a way to return an Inertia response that is nothing more than empty JSON or just an empty response with a 200 status?
Samples of the Code
CommentForm.vue (child form component)
TaskDetail.vue (parent page component)
The text was updated successfully, but these errors were encountered: