Masonry with dynamic class does not always refresh

Wappler Version : 4.8.3
Operating System : mac
Server Model: none – mobile app
Database Type:
Hosting Type:

Expected behavior

When the data of a Masonry is updated via a server connect reload, all elements should be refreshed

Actual behavior

Some data is not refreshed

How to reproduce

In a mobile app…

The masonry:

<div is="dmx-masonry" id="each_recipe_card" dmx-bind:repeat="recipes.data.basics" columns-sm="2" columns-md="3" columns-lg="4" columns-xl="5" columns="2" gutter="10" preserve-order="true" gutter-sm="15" gutter-md="15" gutter-lg="15" gutter-xl="20" key="recipe_id">

Within the masonry, there is an icon:

 <i class="fas fa-heart fa-2x" dmx-class:text-danger="favorite"></i>

When /recipes is loaded, the first recipe has a null value for “favorite” (which is correct):

After opening a modal and toggling favorite, the server connect refreshes content.recipes. The result is that favorite now has a value (which is correct):

The class text-danger is added and the red heart is displayed (which is correct).

Now we toggle the value again using the exact same process and we have a null value again (still correct):

However, the class of text-danger is still applied…This is the bug.

@patrick perhaps part of the recent dmx updates?

1 Like

same problem here with a similar function (favoriting) on a Masonry. Also other actions like filtering within a Masonry, but require multiple clicks before initiating. Sorry I can’t be as specific as @mebeingken (hi Ken :), but his solution will likely be mine. - thanks!

(ps. behavior isn’t consistent, but usually takes two clicks per desired action. variables get properly set before action, action runs, but fails looking for required variable (for insert in this example):

  1. variable/ session gets set:
    dmxState-MAT_id “8396”

  2. insert fails with following network preview message:
    {
    “code”: “23000”,
    “file”: “/opt/bitnami/apache/htdocs/dmxConnectLib/lib/db/Connection.php”,
    “line”: 144,
    “message”: “SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘MAT_id’ cannot be null”,
    “trace”: “#0 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/db/Connection.php(144): PDOStatement->execute()\n#1 /opt/bitnami/apache/htdocs/dmxConnectLib/modules/dbupdater.php(159): lib\db\Connection->execute()\n#2 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(195): modules\dbupdater->insert()\n#3 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(127): lib\App->execSteps()\n#4 /opt/bitnami/apache/htdocs/dmxConnectLib/modules/core.php(97): lib\App->exec()\n#5 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(195): modules\core->condition()\n#6 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(159): lib\App->execSteps()\n#7 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(127): lib\App->execSteps()\n#8 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(116): lib\App->exec()\n#9 /opt/bitnami/apache/htdocs/dmxConnectLib/lib/App.php(94): lib\App->exec()\n#10 /opt/bitnami/apache/htdocs/dmxConnect/api/data_CL/updateADD_MAT_FAV.php(8): lib\App->define()\n#11 {main}”
    }

  3. click same element again and it works fine.

I will check it, I know that in some situations when the value is null we do nothing, but that should not apply for the class toggle.

Please test the following update: dmxAppConnect.zip (26.3 KB)

That takes care of it…Thanks Patrick.

This has been fixed in Wappler 4.9.0

This topic was automatically closed after 2 days. New replies are no longer allowed.