Skip to content

Commit

Permalink
Refactor gfiRequest to stay in line of max length linting rule
Browse files Browse the repository at this point in the history
  • Loading branch information
dopenguin committed Nov 7, 2024
1 parent c2b083e commit a30b6c8
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions packages/plugins/Gfi/src/store/actions/debouncedGfiRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,31 +146,21 @@ const gfiRequest =
}: PolarActionContext<GfiState, GfiGetters>,
{ coordinateOrExtent, modifierPressed = false }: GetFeatureInfoParameters
): Promise<void> => {
const {
afterLoadFunction,
featureInformation,
geometryLayerKeys,
layerKeys,
} = getters
const { afterLoadFunction, layerKeys } = getters
// fetch new feature information for all configured layers
const promisedFeatures = getPromisedFeatures(
map,
configuration,
layerKeys,
coordinateOrExtent
)
const features = (await Promise.allSettled(promisedFeatures)).map(
(result) =>
result.status === 'fulfilled'
? result.value
: errorSymbol(result.reason.message)
const features = (
await Promise.allSettled(
getPromisedFeatures(map, configuration, layerKeys, coordinateOrExtent)
)
).map((result) =>
result.status === 'fulfilled'
? result.value
: errorSymbol(result.reason.message)
)
const srsName: string = map.getView().getProjection().getCode()
let featuresByLayerId = filterAndMapFeaturesToLayerIds(
layerKeys,
// NOTE if there was no configuration, we would not be here
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
configuration.gfi!,
getters.gfiConfiguration,
features,
srsName
)
Expand All @@ -183,13 +173,13 @@ const gfiRequest =
}
if (modifierPressed) {
featuresByLayerId = createSelectionDiff(
featureInformation,
getters.featureInformation,
featuresByLayerId
)
}
commit('setFeatureInformation', featuresByLayerId)
// render feature geometries to help layer
geometryLayerKeys
getters.geometryLayerKeys
.filter((key) => Array.isArray(featuresByLayerId[key]))
.forEach((key) =>
filterFeatures(featuresByLayerId)[key].forEach((feature) =>
Expand Down

0 comments on commit a30b6c8

Please sign in to comment.