Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (_.isEmpty(context)) {
logProviderMissingWarning()
}
const {
disableAnimations = false,
renderer = null,
rtl = false,
theme = emptyTheme,
telemetry = undefined as Telemetry,
_internal_resolvedComponentVariables: resolvedComponentVariables = {},
} = context || {}
const startTime = telemetry && telemetry.enabled ? performance.now() : 0
const ElementType = getElementType(props) as React.ReactType<p>
const stateAndProps = { ...state, ...props }
// Resolve variables for this component, cache the result in provider
if (!resolvedComponentVariables[displayName]) {
resolvedComponentVariables[displayName] =
callable(theme.componentVariables[displayName])(theme.siteVariables) || {} // component variables must not be undefined/null (see mergeComponentVariables contract)
}
// Merge inline variables on top of cached variables
const resolvedVariables = props.variables
? mergeComponentVariables(
resolvedComponentVariables[displayName],
withDebugId(props.variables, 'props.variables'),
)(theme.siteVariables)
: resolvedComponentVariables[displayName]
</p>