Skip to content

Commit 343fc84

Browse files

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MapViewState, PickingInfo } from "@deck.gl/core";
44
import { DeckGLRef } from "@deck.gl/react";
55
import type { IWidgetManager } from "@jupyter-widgets/base";
66
import { NextUIProvider } from "@nextui-org/react";
7+
import debounce from "lodash.debounce";
78
import throttle from "lodash.throttle";
89
import * as React from "react";
910
import { useCallback, useEffect, useRef, useState } from "react";
@@ -193,6 +194,11 @@ function App() {
193194
onClick: onMapClickHandler,
194195
onHover: onMapHoverHandler,
195196
...(isDefined(useDevicePixels) && { useDevicePixels }),
197+
// This is a hack to force a react re-render when the canvas is resized
198+
// https://github.com/developmentseed/lonboard/issues/994
199+
// until the upstream is resolved:
200+
// https://github.com/visgl/deck.gl/issues/9666
201+
onResize: debounce(updateStateCallback, 100),
196202
onViewStateChange: (event) => {
197203
setViewState(sanitizeViewState(views, event.viewState));
198204
},

src/renderers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export type MapRendererProps<ViewsT extends ViewOrViews = ViewOrViews> = Pick<
1313
| "layers"
1414
| "onClick"
1515
| "onHover"
16+
| "onResize"
1617
| "onViewStateChange"
1718
| "parameters"
1819
| "pickingRadius"

0 commit comments

Comments
 (0)