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

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

Open
Khauri opened this issue Oct 25, 2023 · 0 comments
Labels
type:unverified bug A bug report that has not been verified

Comments

@Khauri
Copy link
Contributor

Khauri commented Oct 25, 2023

Marko Version: 5.31.12

marko@5.31.12
@marko/compiler@5.33.3
@marko/tags-api-preview@0.7.2

(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 Khauri added the type:unverified bug A bug report that has not been verified label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:unverified bug A bug report that has not been verified
Projects
None yet
Development

No branches or pull requests

1 participant