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 {
components: {
GlButton,
},
props: {
inject: {
groupAnalyticsCoverageReportsPath: {
type: String,
required: true,
default: '',
},
},
computed: {
......
......@@ -5,18 +5,19 @@ export default () => {
const el = document.querySelector('#js-group-repository-analytics');
const { groupAnalyticsCoverageReportsPath } = el?.dataset || {};
// eslint-disable-next-line no-new
new Vue({
el,
components: {
GroupRepositoryAnalytics,
},
render(createElement) {
return createElement('group-repository-analytics', {
props: {
groupAnalyticsCoverageReportsPath,
},
});
},
});
if (el) {
// eslint-disable-next-line no-new
new Vue({
el,
components: {
GroupRepositoryAnalytics,
},
provide: {
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