Debounced scale computation to reduce GetLegendGraphic requests - #10178
Conversation
From the artifact of the previous workflow run
thanks, updated |
|
Can be the default value be |
|
IMHO, undefined is a good default value for a first release, try it on prod in real conditions, and then 500ms or 1s, maybe more, could be a good default value in a second pass (to be confirmed). This would avoid requesting legends when user takes time when using wheel to zoom, without reducing a lot the user experience in regard to legend. Not sure where we should define this intrusive default value, on ngeo (front, globally shared) or c2cgeoportal (customer project config) side. |
|
@arnaud-morvan I put 200ms as default value in c2cgoportal https://github.com/camptocamp/c2cgeoportal/pull/13187/changes is it too small? |
|
IMHO a higher value is acceptable, updating the map is the priority, having the legend updated after 1s or 2s seems acceptable to me. As far as the map rendering may take 1s, the user may zoom another time after 1s. But this is really subjective in facts, and may depends on user behavior and map rendering time. |
|
I suppose the user expect the legend to update once he finished zooming on his area of interest. |
|
@ochriste What do you think? |
|
As far as I understood : The first legend URL computation is not debounced, so this PR only affect the zoom event. And the first legend loading is lazy : ngeo/src/layertree/component.html.js Line 70 in fb3bf08 => The image is requested only when the image element is visible (when the parent legend element is expanded). All the GetLegendGraphic requests were put in the queue before the GetMap, even when legend element was not visible. => With loading=lazy, it has a side effect, when expanding the legend, the user see the legends loading, one by one, but it reduced the first map rendering in a project with a lot of layers from 2 min to 6 sec => User said : this is wonderfull I would be interested to know if in case a legend has been visible, but become hidden ( we collapsed the parent group in layer tree ), but we change the URL, will we generate a GetLegendGraphic request ? Or will the loading=lazy attribute apply ? => Should we supend requests when image element is not visible and zoom change ? Side noteAs it happens:
Second side note95% of the time legend does not depends on the scaleMy conclusion2 sec is a good default value, if user complains we may reduce it |
|
@arnaud-morvan I will wait the feedback of @ochriste before doing any change :-) |
|
@ochriste is on vacation, but pretty sure he will follow me if you do, put 2 sec please and we will see if somebody complains, actually people complains about map rendering. Or I miss something ? honestly who wants to see the legend updated regarding the scale after 200ms ? |
|
@arnaud-morvan if a legend is collapsed, no subsequent getlegendgraphic request are done, |
|
@sbrunner im ok with anything that improve the current situation, so go ahead. |
@arnaud-morvan just for clarification: the issue is that too many requests are sent to the server, and the mapserver services are getting saturated and fail to handle requests at a proper speed, which impact ALL rendering, including of course the map. |
|
@ochriste yes, when user is zooming he is also looking at the map, not at the legend, if the legend change depending on the scale, 2s seems perfectly acceptable to me, the map rendering should be done in priority. It seems we have the same opinion on this. |
Added a debounce for scale computation when the resolution changes to avoid making many GetLegendGraphic requests.
See JIRA issue: GSGEOC-452.
Examples
Storybook
API help
API documentation