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

Repater component shows extra components when key names contain dots after mutation handling #198

Closed
aleloi opened this issue Jan 17, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@aleloi
Copy link

aleloi commented Jan 17, 2024

Screenshot demonstrating the issue:

2024-01-17-094355_1341x1133_scrot

State mutation handling has a bug. The app runner sends which parts of the state has changed to the UI components. The changes (called mutations) are encoded as a json. Field names in the JSON are interpreted as paths to nested objects. A dot in a field name means a nested object. This has problems if the original StateProxy object had dots in the key names.

I've only encountered that this is a user-facing problem when updating the state for a Repeater object.

This branch contains a minimal reproduction: https://github.com/aleloi/streamsync/tree/issue/repro-of-dots-in-stateproxy-keys-issue. Link to commit with diff.

To get the image above, check out the branch and run streamsync run tests/testapp. Go to the repeater tab and press 'Re-randomize repeater' button.

The expected result is this:

2024-01-17-095224_1343x776_scrot

@ramedina86 ramedina86 added the bug Something isn't working label Jan 22, 2024
@ramedina86
Copy link
Collaborator

Thanks for sharing, we'll definitely take a look at this. Internally, the intended behaviour is that dots should be automatically escaped with backslashes i.e. "." in the generated JSON, when used as part of the name of a state element.

@mmikita95
Copy link
Contributor

Managed to pinpoint it, this offers a fix.

@mmikita95
Copy link
Contributor

mmikita95 commented Jan 25, 2024

@aleloi fix was merged into dev branch. I personally verified the behavior of Repeater in this particular scenario, and, with the new fix, the issue appears to be resolved. I would greatly appreciate if you could confirm it on your end as well, just to be safe.

@aleloi
Copy link
Author

aleloi commented Jan 25, 2024

Thanks, I built from dev and see that it's fixed for my use case!

@aleloi aleloi closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants