platform
platform copied to clipboard
Autocompleting Public Properties - error on boolean false value
Describe the bug If an item with the Boolean value false is returned in the return of the query function of a screen, the autocompletion of public properties fails.
To Reproduce
- Create a new Screen class extending App\Orchid\Screens\BaseScreen
use Orchid\Screen\Screen as Screen;
class DemoScreen extends BaseScreen
- Declare 3 public properties in the class
public $var1 = null;
public $var2 = null;
public $var3 = null;
- Define the query function by returning an array with 3 keys corresponding to the names of the three properties, as described in the documentation. The first element of the array must be a Boolean value false. The elements after the first can be any value.
public function query(Request $request): array
{
return [
'var1' => false,
'var2' => "example1",
'var3' => "example2"
];
}
- Define the layout function by printing the value of $this->var2
public function layout(): array
{
dd($this->var2);
}
- Check the printed output, it will be "null" or the default value of the var2 variable.
Expected behavior string "example1" is expected.
Screenshots
Server (please complete the following information):
- Platfrom Version: 14.17.0
- Laravel Version: 10.38.0
- PHP Version: 8.1
Additional context If the array returning from query function contains a boolean false value, the Autocompleting Public Properties does not work and values are not set to public properties.
In Orchid\Screen\Screen class, in function fillPublicProperty each function is used to iterate properties.
Laravel Each function stop iterating if the callback returns false.
Thank you for reaching out, and I apologize for the delay in response. At the moment, I don't seem to notice the issue you mentioned. It's possible that I have already addressed it earlier but forgot to mention it here.