feat: Add configurable delimiter for dropdown block options#348
Merged
Conversation
Users can now customize the label/value delimiter for dropdown options (previously hardcoded to ":""). This enables support for data containing colons, such as URLs or timestamps. The delimiter is configurable in the UI modal and defaults to ":". - Add delimiter prop to Dropdown struct with default ":" - Implement delimiter-aware option parsing in Rust backend - Add UI field in config modal to customize delimiter - Include comprehensive tests for custom delimiters - Update documentation with examples
Contributor
Greptile SummaryAdds configurable delimiter for dropdown label/value pairs, replacing hardcoded Changes:
Issue Found:
Important Files Changed
|
| const label = trimmed.substring(0, colonIndex).trim(); // what we display | ||
| const value = trimmed.substring(colonIndex + 1).trim(); // what we store as value | ||
| const delimiterIndex = trimmed.indexOf(delimiter); | ||
| if (delimiterIndex > 0 && delimiterIndex < trimmed.length - delimiter.length) { |
Contributor
There was a problem hiding this comment.
logic: Boundary check off by one - should be trimmed.length - 1. With multi-char delimiter like "::", at position length - 2, you'd accept it but then extract empty value.
Suggested change
| if (delimiterIndex > 0 && delimiterIndex < trimmed.length - delimiter.length) { | |
| if (delimiterIndex > 0 && delimiterIndex < trimmed.length - 1) { |
Extract the parseOption function from Dropdown.tsx to a separate parseOption.ts file so it can be tested without importing the entire Dropdown module and its browser dependencies.
Member
|
The TS bindings show up in the crate sometimes if |
Member
Author
|
OH that's it, thank you |
37f1ef5 to
45be5a9
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Change Summary
Users can now customize the label/value delimiter for dropdown options, enabling support for data containing colons like URLs or timestamps. The delimiter defaults to ":" but is configurable in the UI.
Motivation and details
The dropdown block previously used a hardcoded ":" delimiter for label:value pairs, making it impossible to use with data containing colons. This change adds a delimiter prop to the Dropdown struct and implements delimiter-aware parsing in the Rust backend. The frontend now includes a UI field to customize the delimiter. Includes 9 new tests covering single-character, multi-character, and edge case delimiters.
Tasks
docs/(behavior documented in AI block registry)