Conversation
- shepherd.js expects a button's `action` to be the click handler itself, but `TourButton.action` was typed as a function that returns a handler - under the stricter TypeScript 6 checks that came with the Angular 22 upgrade, the handlers in `actionAssignment` were wrapped to match that type, so clicking Next, Previous or a custom button returned the handler instead of running it - type `TourButton.action` as `Step.StepOptionsButton['action']` and assign the handlers directly again, matching the behaviour from before the upgrade - no regression expected: `actionAssignment` is the only place that sets `action`, apps that pass handlers still type-check, and the library builds on Angular 22 / TypeScript 6 GH-87
Screen.Recording.2026-09-28.at.5.05.25.PM.movworking fine |
Akanksha13-dev
approved these changes
Sep 28, 2026
rohit-sourcefuse
approved these changes
Sep 28, 2026
a-ganguly
approved these changes
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In
@sourceloop/user-onboarding-client, the tour's Next, Previous and custom buttons (e.g. Skip) did nothing when clicked. This PR makes them work again.How the bug came about
actionto be the click handler itself ((this: Tour) => void) and calls it on click.TourButton.actionwas typed as() => Step.StepOptionsButton['action'], a function that returns a handler. While theactionAssignmentparameters were untyped (any), this mismatch never caused a compile error.TourButton.actiontype, the assignments were then wrapped asb.action = () => handler. On click, shepherd.js got the handler back but never ran it.The fix
models/tour-button.ts: typeactionasStep.StepOptionsButton['action'], which is what shepherd.js actually uses.lib/tour-service.service.ts(actionAssignment): assign the handlers directly again, as before the upgrade, forprevAction,nextActionand custom registered functions.user-onboarding-element/package.json: the element bundle hash, regenerated by the build.No regression expected
actionAssignmentis the only place that setsaction, so runtime behaviour matches what it was before the Angular 22 upgrade.actionstill type-checks.actionAssignmentto call the returned handler) can remove it after upgrading.Fixes #87
Type of change
How Has This Been Tested?
ng build userOnboardingLibsucceeds on Angular 22.2.0 / TypeScript 6.0.3..d.tshasaction?: Step.StepOptionsButton['action'].() => voidhandler.lerna run test) passes.npm packfromprojects/user-onboarding-lib/dist).Checklist: