[ ] if its your first pull request to Dendron, watch out for the CLA bot that will ask you to agree to Dendron's CLA
[ ] if its your first pull request and you're on our Discord, add your discord handle so that we can award you the horticulturalist role when the PR is merged
tlylt
Commit
[ ] make sure your branch names adhere to our branch style
[ ] make sure the commit message follows Dendron's commit style
[ ] if this pull request is addressing an existing issue, make sure to link this PR to the issue that it is resolving.
I decided to change the condition in QuickPickTemplateSelector.ts to capture the case where the template is not found and return undefined from there. It is also possible to make that change downstream in ApplyTemplateCommand.ts (line 61) with something like:
if (_.isUndefined(templateNote) || templateNote?.children.length === 0) {
throw new DendronError({ message: `Template not found` });
}
Similar to the existing logic when template is undefined, template not found will now trigger an error message.
Let me know if there's any issue with the current approach.
[ ] sticking to existing conventions instead of creating new ones
Tests
I adjusted some code in the integration tests for apply template to add a case for template not found. Not sure if it's the best way to do it so please let me know if it needs to be updated.
[ ] if your change reflects documentation changes, also submit a PR to dendron-site and mention the doc PR link in your current PR (NOTE: submit the PR against the dev branch of the dendron-site repo)
[ ] does this change introduce a new or better way of doing things that others need to be aware of? if so, an async should be created and a process added in Development or Packages
First Time Specifics
[ ] if its your first pull request to Dendron, watch out for the CLA bot that will ask you to agree to Dendron's CLA
[ ] if its your first pull request and you're on our Discord, add your discord handle so that we can award you the horticulturalist role when the PR is merged
Commit
[ ] make sure your branch names adhere to our branch style
[ ] make sure the commit message follows Dendron's commit style
[ ] if this pull request is addressing an existing issue, make sure to link this PR to the issue that it is resolving.
Code
I decided to change the condition in
QuickPickTemplateSelector.ts
to capture the case where the template is not found and return undefined from there. It is also possible to make that change downstream inApplyTemplateCommand.ts
(line 61) with something like:Similar to the existing logic when template is undefined, template not found will now trigger an error message. Let me know if there's any issue with the current approach.
Tests
I adjusted some code in the integration tests for apply template to add a case for template not found. Not sure if it's the best way to do it so please let me know if it needs to be updated.
Manual test:![image](https://user-images.githubusercontent.com/41845017/210734863-07120a80-7ec8-4b4d-b690-60d90ec370de.png)
Docs
[ ] if your change reflects documentation changes, also submit a PR to dendron-site and mention the doc PR link in your current PR (NOTE: submit the PR against the
dev
branch of the dendron-site repo)[ ] does this change introduce a new or better way of doing things that others need to be aware of? if so, an async should be created and a process added in Development or Packages