Files
Laca-City/frontend/node_modules/@tanstack/react-query/build/legacy/useQueries.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

111 lines
3.3 KiB
JavaScript

"use client";
// src/useQueries.ts
import * as React from "react";
import {
QueriesObserver,
QueryObserver,
noop,
notifyManager
} from "@tanstack/query-core";
import { useQueryClient } from "./QueryClientProvider.js";
import { useIsRestoring } from "./IsRestoringProvider.js";
import { useQueryErrorResetBoundary } from "./QueryErrorResetBoundary.js";
import {
ensurePreventErrorBoundaryRetry,
getHasError,
useClearResetErrorBoundary
} from "./errorBoundaryUtils.js";
import {
ensureSuspenseTimers,
fetchOptimistic,
shouldSuspend,
willFetch
} from "./suspense.js";
function useQueries({
queries,
...options
}, queryClient) {
const client = useQueryClient(queryClient);
const isRestoring = useIsRestoring();
const errorResetBoundary = useQueryErrorResetBoundary();
const defaultedQueries = React.useMemo(
() => queries.map((opts) => {
const defaultedOptions = client.defaultQueryOptions(
opts
);
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
return defaultedOptions;
}),
[queries, client, isRestoring]
);
defaultedQueries.forEach((query) => {
ensureSuspenseTimers(query);
ensurePreventErrorBoundaryRetry(query, errorResetBoundary);
});
useClearResetErrorBoundary(errorResetBoundary);
const [observer] = React.useState(
() => new QueriesObserver(
client,
defaultedQueries,
options
)
);
const [optimisticResult, getCombinedResult, trackResult] = observer.getOptimisticResult(
defaultedQueries,
options.combine
);
const shouldSubscribe = !isRestoring && options.subscribed !== false;
React.useSyncExternalStore(
React.useCallback(
(onStoreChange) => shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop,
[observer, shouldSubscribe]
),
() => observer.getCurrentResult(),
() => observer.getCurrentResult()
);
React.useEffect(() => {
observer.setQueries(
defaultedQueries,
options
);
}, [defaultedQueries, options, observer]);
const shouldAtLeastOneSuspend = optimisticResult.some(
(result, index) => shouldSuspend(defaultedQueries[index], result)
);
const suspensePromises = shouldAtLeastOneSuspend ? optimisticResult.flatMap((result, index) => {
const opts = defaultedQueries[index];
if (opts) {
const queryObserver = new QueryObserver(client, opts);
if (shouldSuspend(opts, result)) {
return fetchOptimistic(opts, queryObserver, errorResetBoundary);
} else if (willFetch(result, isRestoring)) {
void fetchOptimistic(opts, queryObserver, errorResetBoundary);
}
}
return [];
}) : [];
if (suspensePromises.length > 0) {
throw Promise.all(suspensePromises);
}
const firstSingleResultWhichShouldThrow = optimisticResult.find(
(result, index) => {
const query = defaultedQueries[index];
return query && getHasError({
result,
errorResetBoundary,
throwOnError: query.throwOnError,
query: client.getQueryCache().get(query.queryHash),
suspense: query.suspense
});
}
);
if (firstSingleResultWhichShouldThrow == null ? void 0 : firstSingleResultWhichShouldThrow.error) {
throw firstSingleResultWhichShouldThrow.error;
}
return getCombinedResult(trackResult());
}
export {
useQueries
};
//# sourceMappingURL=useQueries.js.map