Counter widget sends double requests, the first one has viewport as undefined #10674#10683
Conversation
offtherailz
left a comment
There was a problem hiding this comment.
The effective issue is this, and involves all the ogc filters with empty list of issues:
+ const filterString = filters?.length > 0
+ ? fb.filter(fb.and(
+ ...flatten(filters
+ .filter(filter => !!filter && (isString(filter) || isFilterValid(filter) && !filter.disabled))
+ .map(filter => isString(filter) ? [toFilter(read(filter))] : toOGCFilterParts(filter, ogcVersionOpt, nsPlaceholder)))
+ ))
+ : "";The initial count with no geometry is due to the bbox that is not ready. Instead of filtering out invlid request, fix the invalid request as before (and add a test).
The initial request is anyway performed. Let's see if it is possible to avoid the request if the spatial filter should be present but is not....
If other widgets on map do not have the same issue, let's see why
There was a problem hiding this comment.
no. With this solution we have a regression, the counter completely disappears if the sync is not available.
See this map attached:
This works on dev, and the counter is not visible anymore applying these changes saved in http://localhost:8081/#/viewer/51809
I suggest to :
- See why other widget do not have the same problem
- Apply the same solution of the other widgets
- Test them with both map sync enabled or disabled
- Include also this fix in the PR , with proper unit tests (filter utils line :
#10683 (review)
git diff web/client/utils/FilterUtils.js
diff --git a/web/client/utils/FilterUtils.js b/web/client/utils/FilterUtils.js
index b34ca4d18..cca07a07f 100644
--- a/web/client/utils/FilterUtils.js
+++ b/web/client/utils/FilterUtils.js
@@ -1285,11 +1285,13 @@ export const mergeFiltersToOGC = (opts = {}, ...filters) => {
});
const toFilter = fromObject(fb);
- const filterString = fb.filter(fb.and(
- ...flatten(filters
- .filter(filter => !!filter && (isString(filter) || isFilterValid(filter) && !filter.disabled))
- .map(filter => isString(filter) ? [toFilter(read(filter))] : toOGCFilterParts(filter, ogcVersionOpt, nsPlaceholder)))
- ));
+ const filterString = filters?.length > 0
+ ? fb.filter(fb.and(
+ ...flatten(filters
+ .filter(filter => !!filter && (isString(filter) || isFilterValid(filter) && !filter.disabled))
+ .map(filter => isString(filter) ? [toFilter(read(filter))] : toOGCFilterParts(filter, ogcVersionOpt, nsPlaceholder)))
+ ))
+ : "";
|
Moving the issue back in Ready @rowheat02 |
|
Extra API call for counter and table widget fixed by filtering events checking mapSync and viewport. |
|
@ElenaGallo please test once in DEV and let us know for the backport. |
|
Test passed, @rowheat02 please backport to 2024.02.xx. Thanks |
Description
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
#10674
What is the current behavior?
#10674
What is the new behavior?
API call disabled when called without polygon, specifically filter XML text with undefined value
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information