Skip to content

fix: keep falsy step values, the final voice transcript and cached validators - #396

Merged
LucasBassetti merged 2 commits into
masterfrom
fix/falsy-values-recognition-cache
Sep 27, 2026
Merged

LucasBassetti merged 2 commits into
masterfrom
fix/falsy-values-recognition-cache

Conversation

@LucasBassetti

@LucasBassetti LucasBassetti commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Description

Fixes four bugs found while writing the new documentation (#395). They were already in 0.x.

  • Falsy step values were dropped. triggerNextStep({ value }) ignored 0, false and '', so the step had no value, {previousValue} and trigger functions got undefined, and handleEnd left them out of values. Now only undefined means "no value". This also fixes trigger functions of options whose value is falsy (e.g. { label: 'No', value: false }).
  • The final voice transcript was not used. When the recognition finished, the chatbot submitted the last interim transcript instead of the final one, so the end of the sentence could be missing.
  • Voice input stopped submitting after a manual stop. Once the user stopped a recognition with the mic button, later recognitions never submitted automatically.
  • Cached conversations lost the validator. When a cached conversation was restored while waiting for the user, the validator of that step was gone (functions are not cached), so invalid answers were accepted.

Related issue

None.

Type of change

  • feat: new feature
  • fix: bug fix
  • docs: documentation
  • refactor / perf / test
  • build / ci / chore
  • Breaking change (the title has !, and the migration is described below)

How has this been tested?

A failing test was written first for each bug, then fixed:

  • 0, false and '' are kept as step values and reach handleEnd (3 cases)
  • a falsy option value reaches the trigger function
  • the final transcript is sent before the recognition ends
  • the recognition ends normally again after the user stopped it
  • the validator still works after reloading a cached conversation

Lint, typecheck, build and the 93 tests pass.

Bumps the version to 1.0.1.

Breaking changes

None. handleEnd values now include falsy values, which were missing before.

Checklist

  • The title follows Conventional Commits
  • npm run lint, npm run typecheck and npm test pass
  • Tests cover the change
  • The README is updated when the public API changes (no API change)

…lidators

- triggerNextStep saves 0, false and '' as the step value (only undefined
  means no value), so trigger functions and handleEnd receive them
- speech recognition sends the final transcript before it ends, and
  automatic submission works again after the user stopped a recognition
- a cached conversation restores the validator of the step waiting for
  the user input
@LucasBassetti
LucasBassetti merged commit 522d3e0 into master Sep 27, 2026
3 checks passed
@LucasBassetti
LucasBassetti deleted the fix/falsy-values-recognition-cache branch September 27, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant