-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counter widget sends double requests, the first one has viewport as undefined #10674 #10683
Counter widget sends double requests, the first one has viewport as undefined #10674 #10683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 :
Counter widget sends double requests, the first one has viewport as undefined #10674 #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. |
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