[Merged by Bors] - fix: ensure phrase is a string (COR-10013)#593
Closed
amandasteinhauer wants to merge 2 commits intomasterfrom
Closed
[Merged by Bors] - fix: ensure phrase is a string (COR-10013)#593amandasteinhauer wants to merge 2 commits intomasterfrom
amandasteinhauer wants to merge 2 commits intomasterfrom
Conversation
Apply suggested changes
|
abuyak-vf
approved these changes
Feb 13, 2026
Contributor
Author
|
bors r+ |
bors-vf bot
pushed a commit
that referenced
this pull request
Feb 13, 2026
### TL;DR Fix variable replacement to handle non-string inputs by converting them to strings. ### What changed? Modified the `replaceVariables` function to explicitly convert non-string inputs to strings before processing. Previously, the function would attempt to trim potentially non-string values, which was rarely but occasionally resulting in a `phrase?.trim is not a function` error. Now, the function safely converts the input to a string first, handling all type issues. ### How to test? 1. Call `replaceVariables` with different types of inputs: - String values - Numbers - Undefined values - Null values - Objects 2. Verify that the function correctly converts all inputs to strings without errors 3. Ensure that variable replacement still works as expected with the converted strings ### Why make this change? This change improves the robustness of the `replaceVariables` function by ensuring it can safely handle any type of input. Previously, calling methods like `trim()` on non-string values could cause runtime errors. This fix ensures consistent behavior regardless of input type, preventing potential crashes when the function receives unexpected data types. Co-authored-by: Amanda <amanda.steinhauer@voiceflow.com>
|
Pull request successfully merged into master. Build succeeded: |
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.




TL;DR
Fix variable replacement to handle non-string inputs by converting them to strings.
What changed?
Modified the
replaceVariablesfunction to explicitly convert non-string inputs to strings before processing. Previously, the function would attempt to trim potentially non-string values, which was rarely but occasionally resulting in aphrase?.trim is not a functionerror. Now, the function safely converts the input to a string first, handling all type issues.How to test?
replaceVariableswith different types of inputs:Why make this change?
This change improves the robustness of the
replaceVariablesfunction by ensuring it can safely handle any type of input. Previously, calling methods liketrim()on non-string values could cause runtime errors. This fix ensures consistent behavior regardless of input type, preventing potential crashes when the function receives unexpected data types.