#8647 fix vitest warnings #1467

Merged
jon merged 91 commits from 8647_fix_warnings into dev 2025-04-16 11:18:11 +00:00
1 changed files with 18 additions and 6 deletions
Showing only changes of commit dcd4c327a0 - Show all commits

View File

@ -8,24 +8,36 @@ import { isDialogOpened } from 'src/filters';
const arrayDataStore = useArrayDataStore();
export function useArrayData(key, userOptions) {
key ??= useRoute().meta.moduleName;
Outdated
Review

Esto da warnings? No serà que hay q mockearlo?

Esto da warnings? No serà que hay q mockearlo?

Resuelve la #8028

Resuelve la #8028

Warning en DevTools no en vitest

Warning en DevTools no en vitest
let route = null;
let router = null;
const initializeRouting = () => {
if (!route) route = useRoute();
if (!router) router = useRouter();
return { route, router };
};
// Si no hay key, intentamos obtenerla del route
if (!key) {
const { route: initialRoute, router: initialRouter } = initializeRouting();
key = initialRoute?.meta?.moduleName;
route = initialRoute;
router = initialRouter;
}
if (!key) throw new Error('ArrayData: A key is required to use this composable');
if (!arrayDataStore.get(key)) arrayDataStore.set(key);
const store = arrayDataStore.get(key);
const route = useRoute();
const router = useRouter();
let canceller = null;
onMounted(() => {
setOptions();
reset(['skip']);
const query = route.query;
const { route: initialRoute, router: initialRouter } = initializeRouting();
route = initialRoute;
router = initialRouter;
const searchUrl = store.searchUrl;
if (query[searchUrl]) {
if (route.query[searchUrl]) {
const params = JSON.parse(query[searchUrl]);
const filter =
params?.filter && typeof params?.filter == 'object'