Skip to content
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

[@kbn/handlebars] Ensure only decorators have an options.args property #147791

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

watson
Copy link
Contributor

@watson watson commented Dec 19, 2022

After adding support for decorators an args property has added to HelperOptions (which is shared with decorators). To not leak this into regular helpers and to align with the upstream handlebars, this PR removes the args property from regular helpers so that it's only visible to decorators.

@watson watson added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to the previous minor version (i.e. one version back from main) labels Dec 19, 2022
@watson watson self-assigned this Dec 19, 2022
@watson watson requested a review from a team as a code owner December 19, 2022 17:39
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
canvas 1.0MB 1.0MB +95.0B
uiActionsEnhanced 138.6KB 138.7KB +95.0B
visTypeTimeseries 511.4KB 511.5KB +95.0B
total +285.0B
Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 61 67 +6
osquery 109 115 +6
securitySolution 439 445 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 70 76 +6
osquery 110 117 +7
securitySolution 516 522 +6
total +21

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @watson

Copy link
Contributor

@thomheymann thomheymann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

}
}

// @ts-expect-error: Property 'lookupProperty' does not exist on type 'HelperOptions'
delete options.lookupProperty; // There's really no tests/documentation on this, but to match the upstream codebase we'll remove `lookupProperty` from the decorator context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this change anything / Would it break if you don't follow original Handlebars?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No it doesn't change anything. I think it's just an implementation detail/difference between our implementation and the upstream implementation. But I thought it doesn't hurt to try and match the upstream API. In upstream, lookupProperty is added to options in a separate step for helpers, whereas we just add it up front when creating the options object.

@watson watson merged commit 800f451 into elastic:main Dec 19, 2022
@watson watson deleted the handlebars-fix-helper-options branch December 19, 2022 19:40
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Dec 19, 2022
…rty (elastic#147791)

After adding support for decorators an `args` property has added to
`HelperOptions` (which is shared with decorators). To not leak this into
regular helpers and to align with the upstream handlebars, this PR
removes the `args` property from regular helpers so that it's only
visible to decorators.

(cherry picked from commit 800f451)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.6

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Dec 19, 2022
… property (#147791) (#147799)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[@kbn/handlebars] Ensure only decorators have an `options.args`
property (#147791)](#147791)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Thomas
Watson","email":"watson@elastic.co"},"sourceCommit":{"committedDate":"2022-12-19T19:40:18Z","message":"[@kbn/handlebars]
Ensure only decorators have an `options.args` property
(#147791)\n\nAfter adding support for decorators an `args` property has
added to\r\n`HelperOptions` (which is shared with decorators). To not
leak this into\r\nregular helpers and to align with the upstream
handlebars, this PR\r\nremoves the `args` property from regular helpers
so that it's only\r\nvisible to
decorators.","sha":"800f45180cb1706a67f264ba5cee95c1a2031b8a","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:prev-minor","v8.7.0"],"number":147791,"url":"#147791
Ensure only decorators have an `options.args` property
(#147791)\n\nAfter adding support for decorators an `args` property has
added to\r\n`HelperOptions` (which is shared with decorators). To not
leak this into\r\nregular helpers and to align with the upstream
handlebars, this PR\r\nremoves the `args` property from regular helpers
so that it's only\r\nvisible to
decorators.","sha":"800f45180cb1706a67f264ba5cee95c1a2031b8a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"#147791
Ensure only decorators have an `options.args` property
(#147791)\n\nAfter adding support for decorators an `args` property has
added to\r\n`HelperOptions` (which is shared with decorators). To not
leak this into\r\nregular helpers and to align with the upstream
handlebars, this PR\r\nremoves the `args` property from regular helpers
so that it's only\r\nvisible to
decorators.","sha":"800f45180cb1706a67f264ba5cee95c1a2031b8a"}}]}]
BACKPORT-->

Co-authored-by: Thomas Watson <watson@elastic.co>
crespocarlos pushed a commit to crespocarlos/kibana that referenced this pull request Dec 23, 2022
…rty (elastic#147791)

After adding support for decorators an `args` property has added to
`HelperOptions` (which is shared with decorators). To not leak this into
regular helpers and to align with the upstream handlebars, this PR
removes the `args` property from regular helpers so that it's only
visible to decorators.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes v8.6.0 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants