Skip to content

Commit

Permalink
hotfixes compvariables
Browse files Browse the repository at this point in the history
  • Loading branch information
jhmullen committed Aug 16, 2022
1 parent b64f84a commit ecbcced
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/cms/src/components/ProfileRenderer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ class ProfileRenderer extends Component {
onOpenModal: this.onOpenModal.bind(this),
onTabSelect: this.onTabSelect.bind(this),
variables,
compVariables: comparison ? comparison.variables : false,
comparison,
compVariables: comparison ? comparison.variables : {},
initialVariables,
locale,
print
Expand Down Expand Up @@ -641,6 +642,7 @@ ProfileRenderer.childContextTypes = {
router: PropTypes.object,
variables: PropTypes.object,
initialVariables: PropTypes.object,
comparison: PropTypes.boolean,
compVariables: PropTypes.object,
onSelector: PropTypes.func,
onOpenModal: PropTypes.func,
Expand Down
5 changes: 3 additions & 2 deletions packages/cms/src/components/Viz/Viz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Viz extends Component {
// Variables come from props in the CMS, and Context in the Front-end.
const variables = this.props.variables || this.context.variables;
const compVariables = this.context.compVariables;
const isComparison = compVariables && compVariables.id === variables.id;
const isComparison = this.context.comparison && compVariables.id === variables.id;
// onSetVariables will either come from ProfileBuilder (CMS) or Profile (Front-end)
// But either way, it is delivered via context. Have a backup no-op just in case.
let onSetVariables = d => d;
Expand Down Expand Up @@ -198,7 +198,8 @@ Viz.contextTypes = {
onOpenModal: PropTypes.func,
updateSource: PropTypes.func,
variables: PropTypes.object,
compVariables: PropTypes.object
compVariables: PropTypes.object,
comparison: PropTypes.boolean
};

Viz.defaultProps = {
Expand Down
7 changes: 4 additions & 3 deletions packages/cms/src/components/sections/components/Selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Selector extends Component {
}

onSelectorWrapper(name, value) {
const {onSelector, variables, compVariables} = this.context;
const isComparison = compVariables && compVariables.id === variables.id;
const {onSelector, variables, compVariables, comparison} = this.context;
const isComparison = comparison && compVariables.id === variables.id;
onSelector(name, value, isComparison);
}

Expand Down Expand Up @@ -158,7 +158,8 @@ Selector.contextTypes = {
onSelector: PropTypes.func,
print: PropTypes.bool,
variables: PropTypes.object,
compVariables: PropTypes.object
compVariables: PropTypes.object,
comparison: PropTypes.boolean
};

Selector.defaultProps = {
Expand Down

0 comments on commit ecbcced

Please sign in to comment.