Fix startup crash after filter changes
This commit is contained in:
parent
f251412f86
commit
fd5748f8df
|
|
@ -430,26 +430,6 @@ export function usePostsEngine({
|
||||||
}, 120);
|
}, 120);
|
||||||
}, [mapReady, mapRef]);
|
}, [mapReady, mapRef]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const map = mapRef.current;
|
|
||||||
replacePoolRef.current = true;
|
|
||||||
pendingFilterRef.current = `${mainFilter}|${subFilter}|${timeHours}`;
|
|
||||||
allPostsRef.current = [];
|
|
||||||
setVisiblePosts([]);
|
|
||||||
syncMarkers([]);
|
|
||||||
if (map && clustersEnabled && heatmapEnabled) {
|
|
||||||
updateClusterAreas(map, []);
|
|
||||||
}
|
|
||||||
if (map) {
|
|
||||||
map.__swForceFetchAt = Date.now();
|
|
||||||
setTimeout(() => {
|
|
||||||
try {
|
|
||||||
map.fire("moveend");
|
|
||||||
} catch {}
|
|
||||||
}, 60);
|
|
||||||
}
|
|
||||||
}, [mainFilter, subFilter, timeHours, mapRef, syncMarkers, clustersEnabled, heatmapEnabled, updateClusterAreas]);
|
|
||||||
|
|
||||||
const priorityOpts = {
|
const priorityOpts = {
|
||||||
maxFullCards: 15,
|
maxFullCards: 15,
|
||||||
clusterRadius: 0.002,
|
clusterRadius: 0.002,
|
||||||
|
|
@ -838,6 +818,26 @@ export function usePostsEngine({
|
||||||
[mapRef, markersRef, expandedElRef, theme, searchQuery, forceFullPostId]
|
[mapRef, markersRef, expandedElRef, theme, searchQuery, forceFullPostId]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const map = mapRef.current;
|
||||||
|
replacePoolRef.current = true;
|
||||||
|
pendingFilterRef.current = `${mainFilter}|${subFilter}|${timeHours}`;
|
||||||
|
allPostsRef.current = [];
|
||||||
|
setVisiblePosts([]);
|
||||||
|
syncMarkers([]);
|
||||||
|
if (map && clustersEnabled && heatmapEnabled) {
|
||||||
|
updateClusterAreas(map, []);
|
||||||
|
}
|
||||||
|
if (map) {
|
||||||
|
map.__swForceFetchAt = Date.now();
|
||||||
|
setTimeout(() => {
|
||||||
|
try {
|
||||||
|
map.fire("moveend");
|
||||||
|
} catch {}
|
||||||
|
}, 60);
|
||||||
|
}
|
||||||
|
}, [mainFilter, subFilter, timeHours, mapRef, syncMarkers, clustersEnabled, heatmapEnabled, updateClusterAreas]);
|
||||||
|
|
||||||
const computeVisible = useCallback(
|
const computeVisible = useCallback(
|
||||||
(tf) => {
|
(tf) => {
|
||||||
const basePosts = allPostsRef.current || [];
|
const basePosts = allPostsRef.current || [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue