Jinntec / Fore

Fore - declarative user interfaces in plain HTML
MIT License
82 stars 11 forks source link

@if ignored for fx-dispatch? #178

Closed wolfgangmm closed 2 years ago

wolfgangmm commented 2 years ago

An @if on fx-dispatch does not seem to have an effect. Using the following snippet, the dispatch should never fire, but it always does, no matter what the condition in @if evaluates to:

<fx-control ref="ptr/@target">
  <label>Referenz</label>
  <fx-dispatch name="bibl-changed" event="value-changed" if="false()"></fx-dispatch>
</fx-control>

Checked on Fore 1.2.0.

JoernT commented 2 years ago

Try to wrap into fx-action and move the if and event attributes there. Let me know...

Wolfgang Meier @.***> schrieb am So., 27. Nov. 2022, 11:04:

An @if https://github.com/if on fx-dispatch does not seem to have an effect. Using the following snippet, the dispatch should never fire, but it always does, no matter what the condition in @if https://github.com/if evaluates to:

<fx-control @.***">

— Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
JoernT commented 2 years ago

testing on latest dev worked for me in a standalone test

JoernT commented 2 years ago
    <fx-model>
        <fx-instance>
            <data>
                <item>ite</item>
            </data>
        </fx-instance>
    </fx-model>

    <fx-message event="signal" target="#document">The signal event was fired</fx-message>

    <fx-control id="ctrl" ref="item" update-event="input">
        <label>an item</label>
        <fx-dispatch event="value-changed" name="signal" if="false()"></fx-dispatch>

    </fx-control>

</fx-fore>

does not fire the message and vice versa when if="true()

wolfgangmm commented 2 years ago

See current EDEp code:

<fx-control ref="ptr/@target">
  <label>Referenz</label>
  <fx-dispatch name="bibl-changed" event="value-changed" if="."></fx-dispatch>
</fx-control>

It doesn't matter what I provide for @if, the event always seems to fire.

JoernT commented 2 years ago

should be fixed