tags-api-preview icon indicating copy to clipboard operation
tags-api-preview copied to clipboard

Marko not properly tracking dependency updates in some situations when using the tags-api

Open Khauri opened this issue 2 years ago • 0 comments

Marko Version: 5.31.12

[email protected] @marko/[email protected] @marko/[email protected]

(This issue happens in the marko online playground as well, so whatever environment that uses is also affected)

Details

Dependency tracking in tags api components seems to behave incorrectly based on the type of expression used in the tag.

This example behaves incorrectly.

This example behaves correctly.

The only difference is on line 58 where i've swapped the non-working:

<const/items = Object.values(group.items) />

With the working:

<const/items = group.items />

See the reproduction steps below for instructions on recreating the issue

Expected Behavior

Clicking an item should move it to the new list and remove it from the old list.

Actual Behavior

The item is added to the new list, but also remains in the old list.

Possible Fix

This may be an issue in the tags-api-preview but I'm not sure. If I had to guess, it would have something to do with dependency tracking in member expressions causing the old list not update correctly. This issue does not seem to be present In tags api versions below 0.6.0, ie 0.5.5 (but this also requires a lower marko version, so I couldn't rule out that this was an issue in the compiler).

Additional Info

Your Environment

  • Environment name and version (e.g. Chrome 39, node.js 5.4): Bun 1.0.6, Chrome Version 117.0.5938.149 (Official Build) (arm64)
  • Operating System and version (desktop or mobile): Macbook Pro 13-inch, Apple M1 (2020)
  • Link to your project: N/A

Steps to Reproduce

  1. View the incorrectly working example above in the Marko playground
  2. Click "Apple Pie" then click "Move 1 item here" next to Appetizers
  3. Notice that "Apple Pie" is displayed twice. Also note that the "Actual Data" section displays the correct representation where Apple Pie only exists in one llist
  4. View the correct example or swap Object.values(group.items) with just group.items.
  5. Perform the same steps as above and note that everything works correctly

Stack Trace

Khauri avatar Oct 25 '23 16:10 Khauri