|
1 |
| -import { ref, computed, onMounted } from 'vue'; |
| 1 | +import { ref, computed, onMounted, toRaw } from 'vue'; |
2 | 2 | import { router } from '@inertiajs/vue3';
|
3 | 3 | import type { Page, PageProps } from '@inertiajs/core';
|
4 | 4 | import { FilterMatchMode } from '@primevue/core/api';
|
@@ -30,7 +30,7 @@ export function usePaginatedData(
|
30 | 30 | ) {
|
31 | 31 | const urlParams = ref<PaginatedFilteredSortedQueryParams>({});
|
32 | 32 | const processing = ref<boolean>(false);
|
33 |
| - const filters = ref<PrimeVueDataFilters>(structuredClone(initialFilters)); |
| 33 | + const filters = ref<PrimeVueDataFilters>(structuredClone(toRaw(initialFilters))); |
34 | 34 | const sorting = ref<SortState>({
|
35 | 35 | field: '',
|
36 | 36 | order: 1,
|
@@ -147,7 +147,7 @@ export function usePaginatedData(
|
147 | 147 | }
|
148 | 148 |
|
149 | 149 | function reset(options: InertiaRouterFetchCallbacks = {}): Promise<Page<PageProps>> {
|
150 |
| - const defaultFilters = structuredClone(initialFilters); |
| 150 | + const defaultFilters = structuredClone(toRaw(initialFilters)); |
151 | 151 | Object.keys(defaultFilters).forEach((key) => {
|
152 | 152 | filters.value[key].value = defaultFilters[key].value;
|
153 | 153 | });
|
@@ -236,7 +236,7 @@ export function usePaginatedData(
|
236 | 236 |
|
237 | 237 | function parseUrlParams(urlParamsObj: PaginatedFilteredSortedQueryParams): void {
|
238 | 238 | filters.value = {
|
239 |
| - ...structuredClone(initialFilters), |
| 239 | + ...structuredClone(toRaw(initialFilters)), |
240 | 240 | ...urlParamsObj?.filters,
|
241 | 241 | };
|
242 | 242 |
|
|
0 commit comments