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

[TS] Renderer and designer fixes #4791

Merged
merged 3 commits into from
Sep 22, 2020
Merged

[TS] Renderer and designer fixes #4791

merged 3 commits into from
Sep 22, 2020

Conversation

dclaux
Copy link
Member

@dclaux dclaux commented Sep 21, 2020

Related Issue

Fixes #4767
Fixes #4734
References #4483

Description

  • When toJSON() is automatically invoked via JSON.stringify(), it gets a parameter of type string. The AC renderer's implementation of toJSON() takes an optional parameter of type BaseSerializationContext. When the value of this parameter is not undefined, the code assumes it is of type BaseSerializationContext which is not the case when toJSON() is invoked via JSON.stringify(), and thus generates an exception. This PR fixes that by checking the type of the parameter toJSON() receives.
  • The data structure generated from JSON would cause an exception when the JSON contained an empty array. The code now properly handles that case.
  • New TextBlock elements created in the designer via drag/drop now have their wrap property set to true by default

How Verified

Verified manually in adaptivecards-designer-app and test site

Microsoft Reviewers: Open in CodeFlow

@ghost
Copy link

ghost commented Sep 21, 2020

Hi @dclaux. Thanks for helping make the AdaptiveCards JS renderer + tooling better. As additional verification, once the JS build succeeds, please go to the test site to test out your website/designer changes.

@dclaux dclaux changed the title Fix toJSON fail when invoked via JSON.stringify [TS] Renderer and designer fixes Sep 22, 2020
Fix data structure error with empty arrays
@shalinijoshi19
Copy link
Member

Hey @dclaux mind verifying the 3 changes also in the test site and including that little bit in the "How verified" section pls? https://adaptivecardsci.z5.web.core.windows.net/pr/4791

@dclaux dclaux merged commit 8db0001 into main Sep 22, 2020
@dclaux dclaux deleted the ts/tojson-fix branch September 22, 2020 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants