mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-08-27 12:53:00 +02:00
fix: stabilize v0.9.7 startup and feeds
This commit is contained in:
@@ -345,6 +345,7 @@ const MaplibreViewer = ({
|
||||
const data = useMemo(() => ({ ...coreData, ...extraData }) as DashboardData, [coreData, extraData]);
|
||||
const mapRef = useRef<MapRef>(null);
|
||||
const mapInitRef = useRef(false);
|
||||
const [mapReady, setMapReady] = useState(false);
|
||||
const { theme } = useTheme();
|
||||
const mapThemeStyle = useMemo<maplibregl.StyleSpecification>(
|
||||
() => (theme === 'light' ? lightStyle : darkStyle) as maplibregl.StyleSpecification,
|
||||
@@ -914,15 +915,20 @@ const MaplibreViewer = ({
|
||||
// Load Images into the Map Style once loaded
|
||||
const onMapLoad = useCallback((e: { target: maplibregl.Map }) => {
|
||||
initializeMap(e.target);
|
||||
setMapReady(true);
|
||||
}, [initializeMap]);
|
||||
|
||||
const onMapStyleData = useCallback((e: { target: maplibregl.Map }) => {
|
||||
initializeMap(e.target);
|
||||
setMapReady(true);
|
||||
}, [initializeMap]);
|
||||
|
||||
useEffect(() => {
|
||||
const map = mapRef.current?.getMap();
|
||||
if (map) initializeMap(map);
|
||||
if (map) {
|
||||
initializeMap(map);
|
||||
setMapReady(true);
|
||||
}
|
||||
}, [initializeMap, theme]);
|
||||
|
||||
// Build a set of tracked icao24s to exclude from other flight layers
|
||||
@@ -1561,7 +1567,7 @@ const MaplibreViewer = ({
|
||||
}, [activeLayers.uap_sightings, activeLayers.wastewater, theme]);
|
||||
|
||||
// --- Imperative source updates: bypass React reconciliation for GeoJSON layers ---
|
||||
const mapForHook = mapRef.current;
|
||||
const mapForHook = mapReady ? mapRef.current : null;
|
||||
useImperativeSource(mapForHook, 'commercial-flights', commFlightsGeoJSON);
|
||||
useImperativeSource(mapForHook, 'private-flights', privFlightsGeoJSON);
|
||||
useImperativeSource(mapForHook, 'private-jets', privJetsGeoJSON);
|
||||
|
||||
@@ -3915,7 +3915,7 @@ export function useMeshChatController({
|
||||
wormholeEnabled &&
|
||||
wormholeReadyState &&
|
||||
!selectedGateAccessReady) ||
|
||||
((activeTab === 'infonet' || activeTab === 'meshtastic') && anonymousPublicBlocked) ||
|
||||
(activeTab === 'infonet' && anonymousPublicBlocked) ||
|
||||
(activeTab === 'dms' &&
|
||||
(dmView !== 'chat' ||
|
||||
!selectedContact ||
|
||||
|
||||
@@ -34,7 +34,7 @@ export function useImperativeSource(
|
||||
};
|
||||
|
||||
const pushWhenReady = () => {
|
||||
let attemptsRemaining = 20;
|
||||
let attemptsRemaining = 150;
|
||||
|
||||
const tryPush = () => {
|
||||
if (cancelled) return;
|
||||
@@ -62,6 +62,7 @@ export function useImperativeSource(
|
||||
pushWhenReady();
|
||||
};
|
||||
|
||||
rawMap.on('load', handleStyleData);
|
||||
rawMap.on('styledata', handleStyleData);
|
||||
|
||||
// Skip redundant writes for unchanged references, but keep the styledata
|
||||
@@ -73,6 +74,7 @@ export function useImperativeSource(
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
rawMap.off('load', handleStyleData);
|
||||
rawMap.off('styledata', handleStyleData);
|
||||
if (timerRef.current) clearTimeout(timerRef.current);
|
||||
if (retryTimerRef.current) clearTimeout(retryTimerRef.current);
|
||||
|
||||
Reference in New Issue
Block a user