fix: Don't throw errors for NaN in number operators in the filter component (#9506)
This commit is contained in:
@@ -24,6 +24,10 @@ describe('stringifyExpressionResult()', () => {
|
||||
expect(stringifyExpressionResult({ ok: true, result: null })).toEqual('');
|
||||
});
|
||||
|
||||
it('should return NaN when result is NaN', () => {
|
||||
expect(stringifyExpressionResult({ ok: true, result: NaN })).toEqual('NaN');
|
||||
});
|
||||
|
||||
it('should return [empty] message when result is empty string', () => {
|
||||
expect(stringifyExpressionResult({ ok: true, result: '' })).toEqual('[empty]');
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { ResolvableState } from '@/types/expressions';
|
||||
import { ExpressionError, ExpressionParser, type Result } from 'n8n-workflow';
|
||||
import { i18n } from '@/plugins/i18n';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import type { ResolvableState } from '@/types/expressions';
|
||||
import { ExpressionError, ExpressionParser, type Result } from 'n8n-workflow';
|
||||
|
||||
export const isExpression = (expr: unknown) => {
|
||||
if (typeof expr !== 'string') return false;
|
||||
@@ -128,5 +128,5 @@ export const stringifyExpressionResult = (result: Result<unknown, Error>): strin
|
||||
return i18n.baseText('parameterInput.emptyString');
|
||||
}
|
||||
|
||||
return typeof result.result === 'string' ? result.result : JSON.stringify(result.result);
|
||||
return typeof result.result === 'string' ? result.result : String(result.result);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user