Adding startTransition to defer GPX renderings.
This commit is contained in:
parent
64d928e893
commit
a53ddfa63e
|
@ -1,4 +1,4 @@
|
||||||
import react, { useEffect, useState } from 'react';
|
import react, { startTransition, useEffect, useState } from 'react';
|
||||||
import dispatch from '../../workers/dispatcher-main';
|
import dispatch from '../../workers/dispatcher-main';
|
||||||
import Trk from './Trk';
|
import Trk from './Trk';
|
||||||
import { TileKeyObject, Rectangle } from './types';
|
import { TileKeyObject, Rectangle } from './types';
|
||||||
|
@ -22,7 +22,7 @@ export const Gpx: react.FC<GpxProperties> = (props: GpxProperties) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(`<Gpx>, gpx: ${JSON.stringify(gpx)}`);
|
console.log(`<Gpx>, gpx: ${JSON.stringify(gpx)}`);
|
||||||
setGpx(gpx);
|
startTransition(() => setGpx(gpx));
|
||||||
};
|
};
|
||||||
getGpx();
|
getGpx();
|
||||||
}, [props.id]);
|
}, [props.id]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import react, { useEffect, useState } from 'react';
|
import react, { startTransition, useEffect, useState } from 'react';
|
||||||
import dispatch from '../../workers/dispatcher-main';
|
import dispatch from '../../workers/dispatcher-main';
|
||||||
import Gpx from './Gpx';
|
import Gpx from './Gpx';
|
||||||
import { TileKeyObject, Rectangle } from './types';
|
import { TileKeyObject, Rectangle } from './types';
|
||||||
|
@ -21,7 +21,7 @@ export const Gpxes: react.FC<GpxesProperties> = (props: GpxesProperties) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(`Gpxes, visibles: ${JSON.stringify(gpxes)}`);
|
console.log(`Gpxes, visibles: ${JSON.stringify(gpxes)}`);
|
||||||
setVisibleGpxes(gpxes);
|
startTransition(() => setVisibleGpxes(gpxes));
|
||||||
};
|
};
|
||||||
if (props.viewPort !== undefined) {
|
if (props.viewPort !== undefined) {
|
||||||
getVisibleGpxes();
|
getVisibleGpxes();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import react, { useEffect, useState } from 'react';
|
import react, { startTransition, useEffect, useState } from 'react';
|
||||||
import dispatch from '../../workers/dispatcher-main';
|
import dispatch from '../../workers/dispatcher-main';
|
||||||
import { TileKeyObject, Rectangle } from './types';
|
import { TileKeyObject, Rectangle } from './types';
|
||||||
import getUri from '../../lib/ids';
|
import getUri from '../../lib/ids';
|
||||||
|
@ -22,7 +22,7 @@ export const Trk: react.FC<TrkProperties> = (props: TrkProperties) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(`<Trk>, gpx: ${JSON.stringify(trk)}`);
|
console.log(`<Trk>, gpx: ${JSON.stringify(trk)}`);
|
||||||
setTrk(trk);
|
startTransition(() => setTrk(trk));
|
||||||
};
|
};
|
||||||
getTrk();
|
getTrk();
|
||||||
}, [props.id]);
|
}, [props.id]);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import react, { useEffect, useState } from 'react';
|
import react, { startTransition, useEffect, useState } from 'react';
|
||||||
import { lon2tile, lat2tile } from '../../lib/geo';
|
import { lon2tile, lat2tile } from '../../lib/geo';
|
||||||
import dispatch from '../../workers/dispatcher-main';
|
import dispatch from '../../workers/dispatcher-main';
|
||||||
import { TileKeyObject, Rectangle, Point, geoPoint } from './types';
|
import { TileKeyObject, Rectangle, Point, geoPoint } from './types';
|
||||||
|
@ -26,7 +26,7 @@ export const Trkseg: react.FC<TrksegProperties> = (props: TrksegProperties) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log(`<Trkseg>, gpx: ${JSON.stringify(trk)}`);
|
console.log(`<Trkseg>, gpx: ${JSON.stringify(trk)}`);
|
||||||
setTrkseg(trk);
|
startTransition(() => setTrkseg(trk));
|
||||||
};
|
};
|
||||||
getTrkseg();
|
getTrkseg();
|
||||||
}, [props.id]);
|
}, [props.id]);
|
||||||
|
|
Loading…
Reference in New Issue