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

Server: Serialize Object controls as JSON over the wire #11703

Merged
merged 1 commit into from
Jul 29, 2020

Conversation

jonspalmer
Copy link
Contributor

What I did

Fix the serialization of objects as JSON over the wire that was missed in the refactor of knobs to controls #11658

Cleaned up some cruft along the way.

case 'object':
// send objects as JSON strings
storyArgs[key] = JSON.stringify(argValue);
break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix

@@ -34,7 +34,8 @@
"colour": "deeppink",
"today": "Jan 20 2017 GMT+0",
"items": ["Laptop", "Book", "Whiskey"],
"nice": true
"nice": true,
"other": {"hair": "brown", "eyes": "blue"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't testing object controls in the example app

@@ -6,6 +6,7 @@
- style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`;
- today = new Date(today);
- items = items.split(',');
- other = JSON.parse(other)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proves we have it as json that we can parse

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shilman shilman merged commit 7877bf3 into storybookjs:next Jul 29, 2020
This was referenced Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants