Home > Enterprise >  How to enable preserve scroll on inertia?
How to enable preserve scroll on inertia?

Time:11-08

I have a list with view records. When I update the printflag, the window scrolls on top, event the option preserveScroll: true is set.

Function in Vue:

setPrintFlag(vinylRecord) {
  const self = this
  this.$inertia.put(route('vinylRecords.updatePrintFlag', vinylRecord.id),
    {
    print_flag: !vinylRecord.print_flag
  },
    {
      preserveState: true,
      preverseScroll: true
    }
  )
}

Function in backend (Laravel)

public function updatePrintFlag(UpdatePrintFlagRequest $request, VinylRecord $vinylRecord)
{
  $data = $request->validated();

  $vinylRecord->update($data);

  return back();
}

When I read the doc, it looks all ok, but it doesn't work. Is there a missing param to enable the preserveSroll?

CodePudding user response:

It was a typo, OP initially wrote

preverseScroll: true

while it's

preserveScroll: true
  • Related