Extract shared food dialog automation logic#31
Merged
Conversation
Consolidates the repetitive "Add Food to Diary" dialog automation from quick-add, log-food, and add-custom-food into a shared buildFoodDialogCode() helper in src/kernel/food-dialog.ts. The same ~200-line dialog flow (right-click meal, search, select result, set serving size, click "Add to Diary") appeared in 3 modules with minor variations. This refactor: - Creates configurable buildFoodDialogCode() with options for: - Variable names (foodName, mealLabel, servingCount, etc.) - Error message prefixes - Conditional serving size updates - Dialog dismissal verification - Reduces code duplication by ~500 lines - Improves maintainability for future dialog-related changes - Updates tests to verify shared logic behavior No functional changes - all existing commands work identically. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Increase wait after saving custom food from 1s to 15s to allow indexing - Increase wait after search results appear from 500ms to 2s - Replace Playwright locator filter with page.evaluate() for reliable "Add to Diary" button clicking in GWT context These changes ensure newly created custom foods are findable in search and that the Add to Diary button is reliably clicked. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Owner
|
lgtm! ty |
milldr
approved these changes
May 22, 2026
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.
Consolidates the repetitive "Add Food to Diary" dialog automation from quick-add, log-food, and add-custom-food into a shared buildFoodDialogCode() helper in src/kernel/food-dialog.ts.
The same ~200-line dialog flow (right-click meal, search, select result, set serving size, click "Add to Diary") appeared in 3 modules with minor variations. This refactor:
No functional changes - all existing commands work identically.
🤖 Generated with Claude Code