orchidsoftware / orchidsoftware/platform

Can't use two Orchid\Screen\Layouts\Listener(s) in one Screen

Open
#1,992 6 comments 0 reactions 1 assignee View on GitHub

@tabuna is already working on this.

Since Dec 1, 2021.

Errors
Dominant language
PHP
Stars
4.8k
Forks
663
Avg merge
1d 9h
Merged PRs (30d)
7

Description

I am trying to use two different Listeners at the same Screen
for different cases.
If I use one of them while another is commented out
it works perfectly fine.
But if I use both at the same time I have an error
because of the query if null in another Listener layouts() method then one should be updated.
For example if I use this in Listener:
$this->query->has('some_key')
I will get:
Call to a member function has() on null
They use different async methods and targets.

To Reproduce
Steps to reproduce the behavior:

  1. Create one Listener
  2. Create another listener
  3. Add both to one Screen
  4. Trigger the action for any

Expected behavior
I expect each Listener layout will be updated only if was changed theirs targets.

In one case I need to show one or another input depending on selected dropdown.
and in other I need to hide one button and show another one if there were changed one of three inputs.

Desktop (please complete the following information):

  • OS: macSX Monterey
  • Browser Chrome
  • Version latest
  • "orchid/platform": "9.21.0",

Additional context
Please let me know if you need more details.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.