I've got a component that was used in the column of ag-grid-community
. After moving vue app from lerna to NX, the component works differently - the .data property, that contained some data in lerna, is empty now. No significant changes were made to the app itself, some only some webpack configuration was added to handle css.
How can I fix it? Or if I can't, how can I do it in a different way to make it work again?
Here is the component code:
// listColumns.ts used to configure ag-grid
export const columns = {
// ...
actions: {
field: 'actions',
headerName: 'Actions',
cellRenderer: 'Action',
},
}
// Actions.vue
type Params = {
data: any;
value: ActionDefinition[];
};
type ActionDefinition = {
icon: string;
alt: string;
onClick: (data?: any) => void;
};
export default defineComponent({
name: 'Action',
setup() {
const isLoading = ref(true);
const rowData = ref<any>(null);
const actions = ref<ActionDefinition[] | null>(null);
// I've tried to put it here, with no luck
// const instance = getCurrentInstance();
onMounted(() => {
const instance = getCurrentInstance();
if (instance && !isEmpty(instance.data)) { // instance.data is empty - instance.data == {}
const {data, value} = instance.data.params as Params;
rowData.value = data;
actions.value = value;
isLoading.value = false;
}
});
return {isLoading, rowData};
},
});