orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Empty repository in Listener after validation error #2810

Open darkdarin opened 4 months ago

darkdarin commented 4 months ago

Describe the bug Content of repository in Listener ($this->query) is empty after triggered validation error.

To Reproduce Steps to reproduce the behavior:

  1. Add SubtractListener from Documentation
  2. Add simple Screen with SubtractListener and additional method save
    public function save(Request $request): void
    {
        $request->validate([
            'anyField' => 'required',
        ]);
    }
    1. Add value for minuend and subtrahend fields.
    2. Field result is displayed with value
    3. Save form without anyField value (for trigger error from validation)
    4. See page with validation error, with values in fields minuend and subtrahend, but field result is not displayed. Because this field is displayed when $this->query->has('result'), but no value in repository.

Expected behavior Repository in Listener ($this-query) contents actual data (then field result is displayed after trigger validation error)

Screenshots Step 4 image Step 6 image

Server (please complete the following information):