Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidUpdate(prevProps, prevState) {
if (!canUseDOM) return;
const { action, controlled, index, lifecycle, status } = this.state;
const { debug, run, stepIndex, steps } = this.props;
const { steps: prevSteps, stepIndex: prevStepIndex } = prevProps;
const { setSteps, reset, start, stop, update } = this.store;
const { changed: changedProps } = treeChanges(prevProps, this.props);
const { changed, changedFrom, changedTo } = treeChanges(prevState, this.state);
const step = getMergedStep(steps[index], this.props);
const stepsChanged = !isEqual(prevSteps, steps);
const stepIndexChanged = is.number(stepIndex) && changedProps('stepIndex');
if (stepsChanged) {
if (validateSteps(steps, debug)) {
setSteps(steps);
} else {
console.warn('Steps are not valid', steps); //eslint-disable-line no-console
}
}
/* istanbul ignore else */
if (changedProps('run')) {
componentDidUpdate(prevProps, prevState) {
if (!canUseDOM) return;
const { action, controlled, index, lifecycle, status } = this.state;
const { debug, run, stepIndex, steps } = this.props;
const { steps: prevSteps, stepIndex: prevStepIndex } = prevProps;
const { setSteps, reset, start, stop, update } = this.store;
const { changed: changedProps } = treeChanges(prevProps, this.props);
const { changed, changedFrom, changedTo } = treeChanges(prevState, this.state);
const step = getMergedStep(steps[index], this.props);
const stepsChanged = !isEqual(prevSteps, steps);
const stepIndexChanged = is.number(stepIndex) && changedProps('stepIndex');
if (stepsChanged) {
if (validateSteps(steps, debug)) {
setSteps(steps);
} else {
console.warn('Steps are not valid', steps); //eslint-disable-line no-console
}
}
/* istanbul ignore else */
if (changedProps('run')) {
if (run) {
componentDidUpdate(prevProps) {
const { dispatch } = this.props;
const { changedTo } = treeChanges(prevProps, this.props);
/* istanbul ignore else */
if (changedTo('user.isAuthenticated', true)) {
dispatch(showAlert('Hello! And welcome!', { variant: 'success', icon: 'bell' }));
}
}
componentDidUpdate(prevProps) {
const { lifecycle, spotlightClicks } = this.props;
const { changed, changedTo } = treeChanges(prevProps, this.props);
/* istanbul ignore else */
if (changedTo('lifecycle', LIFECYCLE.TOOLTIP)) {
this.scrollParent.addEventListener('scroll', this.handleScroll, { passive: true });
setTimeout(() => {
const { isScrolling } = this.state;
if (!isScrolling) {
this.updateState({ showSpotlight: true });
}
}, 100);
}
if (changed('spotlightClicks') || changed('disableOverlay') || changed('lifecycle')) {
if (spotlightClicks && lifecycle === LIFECYCLE.TOOLTIP) {
componentDidUpdate(prevProps) {
const {
action,
callback,
continuous,
controlled,
debug,
index,
lifecycle,
size,
status,
step,
update,
} = this.props;
const { changed, changedTo, changedFrom } = treeChanges(prevProps, this.props);
const state = { action, controlled, index, lifecycle, size, status };
const skipBeacon =
continuous && action !== ACTIONS.CLOSE && (index > 0 || action === ACTIONS.PREV);
const hasStoreChanged =
changed('action') || changed('index') || changed('lifecycle') || changed('status');
const hasStarted = changedFrom(
'lifecycle',
[LIFECYCLE.TOOLTIP, LIFECYCLE.INIT],
LIFECYCLE.INIT,
);
const isAfterAction = changedTo('action', [
ACTIONS.NEXT,
ACTIONS.PREV,
ACTIONS.SKIP,
ACTIONS.CLOSE,
componentDidUpdate(prevProps) {
const { dispatch, github } = this.props;
const { changedTo } = treeChanges(prevProps, this.props);
if (changedTo('github.repos.status', STATUS.ERROR)) {
dispatch(showAlert(github.repos.message, { variant: 'danger' }));
}
}