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

fix: Remove join filters and related workarounds in replacement card #1808

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

remydenton
Copy link
Collaborator

@remydenton remydenton commented Apr 2, 2020

Jira

http://vjira2:8080/browse/BDS-2059

Summary

Adds support for render arrays to replacement card

Details

This PR replaces {{content | join}} (and all the related workarounds, such as {{ card_replacement_body_content | join | replace({"UTF-8": ""}) | raw }}
) with a solution that supports render arrays, doesn't require any workarounds, and is consistent with our docs and all our other components. It's also quite simple:

{{ content }}.

FAQ

Why was the join filter used to begin with?
I think it was just a mistake. There's no usage of | join in the original card. There are some usages of the join filter directly in blueprints. Maybe this was an attempt at a shortcut for that and we just forgot to take it out?

Is this backwards breaking?
Yes. Oddly, there were no usages of replacement card in pattern lab that depended upon the join filter-- removing it didn't require any changes. However, there are some places in the Academy site that do (I created a PR to address those-- once it's merged, there should be no side effects of this change downstream https://gitlab.com/pegadigital/pa/pegaacademy/-/merge_requests/80).

Why is this not backwards compatible or in a major release then?
It would be a pain to deprecate it instead (what do you call the new variable if not content?) and because replacement card is only actively in use on Academy. I'm operating under the assumption that replacement card is still technically experimental.

What's the utf-8 bug referenced in the comments?
This happens when a Drupal Markup object is passed through the join filter. If you imagine the markup object looking something like {'Text string', 'UTF-8'} (the second parameter being the encoding), you can understand why. Printing the markup object directly does not have this problem.

Was this the problem @charginghawk was solving in this PR?
Apparently not. That code was using the old card, which doesn't use join. So something else was wrong there.

How to test

  • Confirm no regressions in replacement card or blueprints.

@remydenton remydenton added the bug label Apr 2, 2020
@remydenton remydenton added this to the v2.21.0 milestone Apr 2, 2020
Copy link
Collaborator

@danielamorse danielamorse left a comment

Choose a reason for hiding this comment

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

Agree with this solution 👍 Let's fix this now while the component is only used on Academy. PR on Academy board looks good too and has been merged.

@danielamorse danielamorse merged commit 3ffd69a into master Apr 7, 2020
@danielamorse danielamorse deleted the fix/BDS-2059-card-support-render-array branch April 7, 2020 18:00
@sghoweri
Copy link
Contributor

sghoweri commented Apr 8, 2020

PR was released with v2.21.0

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

Successfully merging this pull request may close these issues.

None yet

3 participants