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

Json iterating per child element, rather than by parent element #239

Open
kaigon opened this issue Apr 21, 2021 · 2 comments
Open

Json iterating per child element, rather than by parent element #239

kaigon opened this issue Apr 21, 2021 · 2 comments
Assignees
Labels

Comments

@kaigon
Copy link

kaigon commented Apr 21, 2021

Which version of the plugin are you using?
[ ] Data Populator for Sketch
[x ] Data Populator for Adobe XD

Describe the bug
Plugin is iterating through json keys for every layer, ignoring the intended grouping structure within XD. For example, in the "Contact" example you provided, rather than filling the first group with values from the first item in the data, it instead uses the first item for the name element, then the second item for the image element, ([0].image, [0].firstname, [0].job, [0].email, etc, it instead fills it in with [0].image, [1].firstname, [2].job, [3].email), etc.

Specifically: the first card has the image for Cheryl Carter, which is from the data item with id:1. But for the 'Primary Info' layer, it lists 'Heather Morales's name instead, which is from the id:2's data. Additionally, the 'Secondary Info' uses job / company values from id:3's data, and the two 'Additional Info' layers are pulling the email from id:4's data, and the phone from id:5's data.

Interestingly, it's also skipping over every 6th item in the json (in the Contacts example). Presumably because the plugin is treating the BG item as a populatable layer?

The data is technically pulling valid information into the appropriate areas, and is still arguably better than standard lorem ipsum, but it still creates some weird visual confusion. In the provided Lego Minis example, the image of the figure is completely unrelated to the figure's name. It can create visual confusion for the person looking it over, and distract them from the design itself, instead inviting discussion on the wrong topic (why the data is 'wrong').

To Reproduce
Just run the plugin in your Contacts example as described above. Probably easier to see when you turn off randomization.

Expected behavior
I would expect the plugin to respect the grouping of the items in XD. When using a repeating grid, first item in the grid should use data from item 1 in the json, and the second item in the grid should use the data from item 2 in the json, etc.

Screenshots
Contacts screenshot that shows the data for each card using data from multiple items in the feed, and failing to populate the entire grid because it ran out of data as a result:
datapopulator-issu

Environment (please complete the following information):

  • Windows 10 Pro x64
  • Adobe XD 38.1.12.2
  • Plugin Version 4.0.0
@nitrada
Copy link
Member

nitrada commented May 9, 2021

@kaigon something's broken and we're investigating the issue. in the meantime, if you use "a group of groups" instead of a repeat grid, everything works fine.

@nitrada
Copy link
Member

nitrada commented May 21, 2021

hey @kaigon, we haven't fixed this issue with repeat grids yet, but @drosen-appneta thankfully pointed out there's a great workaround you can use: put the items of your repeat grid into a group and data populating works as expected.

Here's what I did in the "Contacts" example you mentioned for the first grid:
image

Can you confirm this unblocks you for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants