Skip to content

Commit

Permalink
fix(client): Catch promise when loading animated tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
clementprdhomme committed Nov 22, 2024
1 parent 62c484c commit 30444ca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions client/src/components/map/layer-manager/animated-layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { TileLayer } from "@deck.gl/geo-layers";
import { BitmapLayer } from "@deck.gl/layers";
import parseAPNG from "apng-js";
import { getMonth } from "date-fns";
import { RasterLayerSpecification } from "mapbox-gl";
import { useContext, useEffect } from "react";
import { RasterLayer, RasterSource } from "react-map-gl";
import { RasterSource } from "react-map-gl";

import { LayerConfig } from "@/types/layer";

Expand All @@ -20,7 +21,7 @@ const AnimatedLayer = ({ config, date, beforeId }: AnimatedLayerProps) => {
const { addLayer, removeLayer } = useContext(DeckGLMapboxOverlayContext);

useEffect(() => {
const style = config.styles[0] as RasterLayer;
const style = config.styles[0] as RasterLayerSpecification;
const source = config.source as RasterSource;
const frameIndex = getMonth(date);

Expand Down Expand Up @@ -61,7 +62,8 @@ const AnimatedLayer = ({ config, date, beforeId }: AnimatedLayerProps) => {
bitmapData: createImageBitmap(frame.imageData as Blob),
};
});
});
})
.catch(() => {});
},
renderSubLayers: (subLayer) => {
if (!subLayer || !subLayer.data || !subLayer.tile) {
Expand Down

0 comments on commit 30444ca

Please sign in to comment.