Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocompleting Public Properties - error on boolean false value #2783

Open
m3rlo87 opened this issue Dec 30, 2023 · 1 comment
Open

Autocompleting Public Properties - error on boolean false value #2783

m3rlo87 opened this issue Dec 30, 2023 · 1 comment
Assignees
Labels

Comments

@m3rlo87
Copy link

m3rlo87 commented Dec 30, 2023

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

  1. Create a new Screen class extending App\Orchid\Screens\BaseScreen
use Orchid\Screen\Screen as Screen;
class DemoScreen extends BaseScreen
  1. Declare 3 public properties in the class
    public $var1 = null;
    public $var2 = null;
    public $var3 = null; 
  1. 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"
        ];

    } 
  1. Define the layout function by printing the value of $this->var2
public function layout(): array
  {
      dd($this->var2);
  } 
  1. Check the printed output, it will be "null" or the default value of the var2 variable.

Expected behavior
string "example1" is expected.

Screenshots
image
image

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.

@m3rlo87
Copy link
Author

m3rlo87 commented Dec 30, 2023

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.

@m3rlo87 m3rlo87 closed this as completed Dec 30, 2023
@m3rlo87 m3rlo87 reopened this Dec 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants