-
-
Notifications
You must be signed in to change notification settings - Fork 167
fix: restore compatibility with Templater 2.18.0 #1087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Templater 2.18.0 introduced a breaking change in its `parse_template` API.
The `RunningConfig` type now requires a `frontmatter` field, which QuickAdd
was not providing. This caused `Object.keys(undefined)` to throw when
Templater's `merge_objects` attempted to process the missing field.
Root cause: Templater commit db9a91e added frontmatter merging support for
`tp.file.include`. The new code path calls `merge_objects(frontmatter,
config.frontmatter)` unconditionally, but QuickAdd passed only
`{ target_file, run_mode }`.
Fix:
- Use `create_running_config()` when available (Templater 2.18.0+) to get
a properly initialized config with all required fields
- Fall back to manual config with `frontmatter: {}` for older versions
This approach is forward-compatible: future Templater releases that add
new required fields to RunningConfig will be handled automatically via
`create_running_config()`.
Closes #1085
Closes #1086
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR updates QuickAdd's Templater integration to support the new API introduced in Templater v2.18.0. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
🎉 This PR is included in version 2.10.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Fixes Capture Choices crashing with
Cannot convert undefined or null to objectwhen Templater 2.18.0 is installed.Closes #1085
Closes #1086
Root Cause
Templater 2.18.0 (commit db9a91e) added frontmatter merging support for
tp.file.include. This introduced a breaking change to theparse_templateAPI:Before (2.17.x):
After (2.18.0):
QuickAdd called
parse_templatewith:Templater 2.18.0's
parse_templatenow executes:And
merge_objectsimmediately calls:Fix
Prefer
create_running_config()when available (Templater 2.18.0+). This factory method returns a properly initialized config with all required fields, including any future additions.Fallback to manual config with
frontmatter: {}for older Templater versions that don't exposecreate_running_config.Why This Is Safe
frontmatter: {}matches Templater's internal default fromcreate_running_config()merge_objects({}, source)is a no-op (returns immediately when source is empty)tp.file.includein QuickAdd templatesCompatibility
create_running_config)create_running_config()for proper initializationcreate_running_config()handles new required fields automaticallyTest Plan
tp.file.includein QuickAdd templates merges frontmatter correctlySummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.