Memoising `<TileSet>`
This commit is contained in:
parent
edca3f0d1b
commit
7322e5f5c4
|
@ -1,5 +1,5 @@
|
||||||
import react, { } from 'react';
|
import react, { memo } from 'react';
|
||||||
import { range } from 'lodash';
|
import { isEqual, range } from 'lodash';
|
||||||
|
|
||||||
import { Rectangle, TileKeyObject } from './types';
|
import { Rectangle, TileKeyObject } from './types';
|
||||||
import tileUri from './uris';
|
import tileUri from './uris';
|
||||||
|
@ -51,9 +51,8 @@ export interface TileSetProperties {
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export const TileSet: react.FC<TileSetProperties> = (
|
export const TileSet: react.FC<TileSetProperties> = memo(
|
||||||
props: TileSetProperties
|
(props: TileSetProperties) => {
|
||||||
) => {
|
|
||||||
// console.log(`Rendering TiledLayer: ${JSON.stringify(props)}`);
|
// console.log(`Rendering TiledLayer: ${JSON.stringify(props)}`);
|
||||||
|
|
||||||
const key = tileUri({
|
const key = tileUri({
|
||||||
|
@ -97,6 +96,8 @@ export const TileSet: react.FC<TileSetProperties> = (
|
||||||
}
|
}
|
||||||
|
|
||||||
return <>{Array.from(tiles.values())}</>;
|
return <>{Array.from(tiles.values())}</>;
|
||||||
};
|
},
|
||||||
|
isEqual
|
||||||
|
);
|
||||||
|
|
||||||
export default TileSet;
|
export default TileSet;
|
||||||
|
|
Loading…
Reference in New Issue