You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have this dataSource code for my AGGrid serverside model data fetching:
constdataSource={getRows: async(params: IServerSideGetRowsParams)=>{try{const{ data }=awaituseHttp.post(props.endpoint,{filterModel: params.request.filterModel,sortModel: params.request.sortModel,startRow: params.request.startRow,endRow: params.request.endRow,});params.success({rowData: data.data,rowCount: data.total,});}catch(error){console.error("Error fetching rows:",error);params.fail();}// Update filter model from preferences if availableif(preferencesStorage.value&&props.tableName!==null){params.api.setFilterModel(preferencesStorage.value.filterModel||null);}autoSizeTable();},};
I tried wrapping the post request in useQuery, but it's throwing me that: vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.
and Error fetching rows: Error: vue-query hooks can only be used inside setup() function or functions that support injection context.
The whole const datasource function is at the root level of <script setup> in my ag-grid wrapper component.
What's the best way to handle this?
I've tried using the queryClient.fetchQuery() but that loses the whole re-fetching, bg fetching etc.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So I have this dataSource code for my AGGrid serverside model data fetching:
I tried wrapping the post request in useQuery, but it's throwing me that:
vue-query composable like "useQuery()" should only be used inside a "setup()" function or a running effect scope. They might otherwise lead to memory leaks.
and
Error fetching rows: Error: vue-query hooks can only be used inside setup() function or functions that support injection context.
The whole
const datasource
function is at the root level of<script setup>
in my ag-grid wrapper component.What's the best way to handle this?
I've tried using the
queryClient.fetchQuery()
but that loses the whole re-fetching, bg fetching etc.Beta Was this translation helpful? Give feedback.
All reactions