Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes input parsing issues in the gauge example where empty text fields were incorrectly parsed as [""] instead of [], causing errors when queries expected no parameters. The changes standardize parameter handling and improve SQL query argument parsing.
Key Changes:
- Updated function callback signatures to use required (non-optional) parameters
- Replaced string fallback patterns from
?? ""to no fallback, and numeric fallbacks from?? 0to|| 0 - Improved SQL query parameter parsing to use proper JSON parsing with error handling
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| arguments: string[]; | ||
| name: string; | ||
| functionCallback: (input?: string, inputAlt?: string) => Promise<unknown>; | ||
| functionCallback: (input: string, inputAlt: string) => Promise<unknown>; |
There was a problem hiding this comment.
The functionCallback signature requires two parameters (input: string, inputAlt: string), but some callbacks in the functionList (e.g., lines 48, 222) take no parameters. This creates a type mismatch. Consider making the parameters optional with (input?: string, inputAlt?: string) or handling functions with different arities differently.
| functionCallback: (input: string, inputAlt: string) => Promise<unknown>; | |
| functionCallback: (input?: string, inputAlt?: string) => Promise<unknown>; |
Resolves #29
Previous logic led to an empty text field being parsed as
[""], which caused an error on the Rust side since that empty string counts as a parameter, and if the query doesn't expect any, it would error. New behavior expects either nothing in the field (leading to an empty array), or a JSON formatted array.Additionally, there was incorrect fallbacks for an empty string in the argument text field. This is now fixed