Skip to content

Commit

Permalink
Merge pull request #114 from gravity-ui/better-debug-messages
Browse files Browse the repository at this point in the history
fix(onboarding): fix debug messages
  • Loading branch information
vanilla-wave authored Sep 20, 2024
2 parents 67315e5 + 8495ed9 commit 94bafdd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,13 @@ export class Controller<HintParams, Presets extends string, Steps extends string
stepSlug,
element,
}: Omit<ReachElementParams<Presets, Steps>, 'preset'>) => {
this.logger.debug('Step element reached', stepSlug, element);
this.reachedElements.set(stepSlug, element);

const preset = this.findActivePresetWithStep(stepSlug);

if (!preset) {
this.logger.debug('Not found preset for step', stepSlug);
return;
}

Expand All @@ -207,14 +209,14 @@ export class Controller<HintParams, Presets extends string, Steps extends string

if (shouldProcessAppearance) {
await this.processElementAppearance(stepData);
} else {
this.logger.debug('Reject process appearance', stepSlug);
}
};

processElementAppearance = async (stepData: ReachElementParams<Presets, Steps>) => {
const {preset, element, stepSlug} = stepData;

this.logger.debug('Step element reached', preset, stepSlug, element);

const allowRun = await this.events.emit('beforeShowHint', {stepData});

if (!this.state.base.enabled) {
Expand Down Expand Up @@ -749,7 +751,7 @@ export class Controller<HintParams, Presets extends string, Steps extends string
private ensurePresetExists(preset: string): asserts preset is Presets {
// @ts-ignore
if (!this.options.config.presets[preset]) {
this.logger.error('No preset in config');
this.logger.error('No preset in config', preset);

throw new Error('No preset in config');
}
Expand Down

0 comments on commit 94bafdd

Please sign in to comment.