laravel-splade icon indicating copy to clipboard operation
laravel-splade copied to clipboard

FormBuilder->submitOnChange is setting stay() and preserveScroll() without instruction

Open stuartcusackie opened this issue 1 year ago • 0 comments

  • Laravel Version: 10.13.5
  • PHP Version: 8.1.12
  • Splade JS Version (npm): 1.4.14
  • Splade PHP Version (composer): 1.4.14
  • Dev environment: Windows Laragon
  • Using Splade JetStream

Description:

I have a simple Form Class, with a single field that submitsOnChange:

$form
  ->action(route('handle-form'))
  ->method('POST')
  ->submitOnChange();

The page should redirect but in fact the page stays the same and I get an empty response. I noticed that my requests have these flags:

X-Splade-Preserve-Scroll: true
X-Splade-Prevent-Refresh: true

I did not set stay() or preserveScroll(), and I don't think there is a way to unset them. These have no effect:

  ->stay(false)
  ->preserveScroll(false)

If I use form components instead OR if I replace submitOnChange with a submit button then everything works fine. Seems like there's something wrong in the code and it is forcing stay() and preserveScroll().

Thanks. Awesome package so far!

stuartcusackie avatar Jun 21 '23 20:06 stuartcusackie