- Bloodhound Initialization:
- Changed the suggestion object structure to a flattened format for Typeahead compatibility.
- Removed nested `display` structure in favor of direct `displayLabel` and `displayDescription` fields.
- Simplified the construction of suggestion objects by directly setting flattened fields.
- Typeahead Initialization:
- Enhanced logging in the JavaScript initialization script for better debugging.
- Updated the `display` function in Typeahead to use flattened fields (`displayLabel` and `displayDescription`) instead of nested `display` objects.
- Improved error handling and logging for cases where suggestions are not arrays or are empty.
- Selection Handling:
- Added detailed logging for selected suggestions in both Rust and JavaScript.
- Ensured the input field is updated with the selected suggestion's label.
- Code Cleanup:
- Removed redundant nested object creation for `display` fields in Bloodhound initialization.
- Streamlined the JavaScript initialization script for better readability and maintainability.
- Consolidated logging statements for consistent debugging output.
- Improved Bloodhound initialization:
- Added nested display structure for suggestions (label and description).
- Included a response filter to handle empty responses gracefully.
- Added rate-limiting and wildcard support for remote queries.
- Enhanced Typeahead initialization:
- Added custom templates for rendering suggestions with nested display fields.
- Included debug logs for better traceability of Typeahead and Bloodhound instances.
- Improved error handling for deserialization of suggestions.
- Added support for opening the dropdown on receiving suggestions.
- Updated input event handler to include additional debug checks for Typeahead instance.
- Ensured proper cleanup and memory management for closures and global handlers.
- Added custom CSS styles for `.typeahead` input and suggestion dropdown to enhance UI/UX.
- Improved Bloodhound initialization by adding explicit global storage for the instance.
- Enhanced `initialize_bloodhound` to include proper rate limiting, wildcard configuration, and tokenizer setup.
- Refactored `initialize_typeahead` to include a more robust dataset configuration with templates for rendering suggestions.
- Fixed DOM element access in the `on:input` handler to ensure proper interaction with the input element.
- Simplified the `remote_fn` logic in `initialize_bloodhound` for fetching and syncing suggestions.
- Added error handling and logging for better debugging during Typeahead initialization.
- Ensured closures are properly registered in the global scope to handle Typeahead events.
- Updated the JavaScript initialization script to use bracket notation for safer handler invocation.
- Removed the additional inclusion of `corejs-typeahead` script from the `<head>` section.
Changes:
* Replaced `let current_url = get_current_url();` with `let current_url = Rc::new(get_current_url());` to share the current URL between closures.
* Wrapped `add_property` and `update_item` functions in Arc to share them between closures.
* Updated `save_item_to_db` function to take `current_url` as an argument and use it to construct the ItemToSend struct.
* Updated `fetch_property_labels` function to use the `property_ids` vector instead of a single property ID.
* Updated `fetch_item_properties` function to use the `wikidata_id` parameter instead of a hardcoded value.
* Updated `WikidataResponse` struct to use a `Vec<WikidataSuggestion>` instead of a single `WikidataSuggestion`.
- Refactor `fetch_item_properties` to handle nested JSON types efficiently
- Introduce `parse_property_value` for structured processing of various value types
- Handle time values with varying precision (year, month, day)
- Parse and format dates from RFC 3339 format
- Support fetching and displaying labels for Wikidata entity references
- Replace raw JSON object handling with cleaner structured parsing
- Update property label fetching and signal updates for better UI data synchronization