Fix startup crash after filter changes
This commit is contained in:
parent
f251412f86
commit
fd5748f8df
|
|
@ -430,26 +430,6 @@ export function usePostsEngine({
|
|||
}, 120);
|
||||
}, [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 = {
|
||||
maxFullCards: 15,
|
||||
clusterRadius: 0.002,
|
||||
|
|
@ -838,6 +818,26 @@ export function usePostsEngine({
|
|||
[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(
|
||||
(tf) => {
|
||||
const basePosts = allPostsRef.current || [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue