Commit d9abad9d authored by Scott Hampton's avatar Scott Hampton

Provide path instead of props

Use provide/inject instead of props to give
the path to the component since we don't
need it to be reactive.

Also watch for `el` to be null/undefined.
parent 67b01523
...@@ -8,10 +8,10 @@ export default { ...@@ -8,10 +8,10 @@ export default {
components: { components: {
GlButton, GlButton,
}, },
props: { inject: {
groupAnalyticsCoverageReportsPath: { groupAnalyticsCoverageReportsPath: {
type: String, type: String,
required: true, default: '',
}, },
}, },
computed: { computed: {
......
...@@ -5,18 +5,19 @@ export default () => { ...@@ -5,18 +5,19 @@ export default () => {
const el = document.querySelector('#js-group-repository-analytics'); const el = document.querySelector('#js-group-repository-analytics');
const { groupAnalyticsCoverageReportsPath } = el?.dataset || {}; const { groupAnalyticsCoverageReportsPath } = el?.dataset || {};
// eslint-disable-next-line no-new if (el) {
new Vue({ // eslint-disable-next-line no-new
el, new Vue({
components: { el,
GroupRepositoryAnalytics, components: {
}, GroupRepositoryAnalytics,
render(createElement) { },
return createElement('group-repository-analytics', { provide: {
props: { groupAnalyticsCoverageReportsPath,
groupAnalyticsCoverageReportsPath, },
}, render(createElement) {
}); return createElement('group-repository-analytics', {});
}, },
}); });
}
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment