More FE changes
This commit is contained in:
parent
f114ada255
commit
a48eb945e0
48 changed files with 4127 additions and 1751 deletions
|
|
@ -18,6 +18,8 @@ import {
|
|||
} from '../lib/api';
|
||||
import { getSchoolBackendFeatureName } from '../lib/school-filter';
|
||||
import { getSpecificCrimeFeatureName } from '../lib/crime-filter';
|
||||
import { getEthnicityFeatureName } from '../lib/ethnicity-filter';
|
||||
import { getPoiDistanceFeatureName } from '../lib/poi-distance-filter';
|
||||
import { POSTCODE_ZOOM_THRESHOLD } from '../lib/consts';
|
||||
import { COLOR_RANGE_LOW_PERCENTILE, COLOR_RANGE_HIGH_PERCENTILE } from '../lib/consts';
|
||||
import { type TravelTimeEntry } from './useTravelTime';
|
||||
|
|
@ -86,7 +88,11 @@ export function useMapData({
|
|||
const usePostcodeView = zoom >= POSTCODE_ZOOM_THRESHOLD;
|
||||
const getBackendFeatureName = useCallback(
|
||||
(name: string) =>
|
||||
getSchoolBackendFeatureName(name) ?? getSpecificCrimeFeatureName(name) ?? name,
|
||||
getSchoolBackendFeatureName(name) ??
|
||||
getSpecificCrimeFeatureName(name) ??
|
||||
getEthnicityFeatureName(name) ??
|
||||
getPoiDistanceFeatureName(name) ??
|
||||
name,
|
||||
[]
|
||||
);
|
||||
const dataViewFeature = useMemo(
|
||||
|
|
@ -279,9 +285,11 @@ export function useMapData({
|
|||
useEffect(() => {
|
||||
if (!bounds) {
|
||||
latestDataRequestKeyRef.current = '';
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
latestDataRequestKeyRef.current = dataRequestKey;
|
||||
setLoading(true);
|
||||
|
||||
if (debounceRef.current) {
|
||||
clearTimeout(debounceRef.current);
|
||||
|
|
@ -294,7 +302,6 @@ export function useMapData({
|
|||
abortControllerRef.current = new AbortController();
|
||||
|
||||
const requestKey = dataRequestKey;
|
||||
setLoading(true);
|
||||
try {
|
||||
if (usePostcodeView) {
|
||||
const params = new URLSearchParams({ bounds: boundsParam });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue