Skip to content

Commit

Permalink
fix: RLayerTileWMS refresh when url or other props change (#249)
Browse files Browse the repository at this point in the history
Co-authored-by: yupeng.zhou <yupeng.zhou@zelostech.com>
  • Loading branch information
boborua and yupeng.zhou committed Apr 29, 2024
1 parent 20a9ed6 commit 05f8fbb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/layer/RLayerTileWMS.tsx
Expand Up @@ -42,4 +42,17 @@ export default class RLayerTileWMS extends RLayerRaster<RLayerTileWMSProps> {
this.ol.setSource(this.source);
this.attachOldEventHandlers(this.source);
}

componentDidUpdate(
prevProps: Readonly<RLayerTileWMSProps>,
prev: Readonly<unknown>,
snap: unknown
): void {
for (const prop of ['params', 'url', 'projection']) {
if (this.props[prop] !== prevProps[prop]) {
super.componentDidUpdate(prevProps, prev, snap);
return;
}
}
}
}

0 comments on commit 05f8fbb

Please sign in to comment.