Skip to content

#11353: fix - preserve cfg maxItems value when loading saved maps#11354

Merged
offtherailz merged 2 commits intogeosolutions-it:masterfrom
mahmoudadel54:issue_11353
Jul 24, 2025
Merged

#11353: fix - preserve cfg maxItems value when loading saved maps#11354
offtherailz merged 2 commits intogeosolutions-it:masterfrom
mahmoudadel54:issue_11353

Conversation

@mahmoudadel54
Copy link
Copy Markdown
Contributor

Description

This PR handles always use cfg maxItems for Identify requests via:

  • Prevent mapInfoConfiguration from overriding cfg maxItems
  • Ensures all loaded maps use current configuration maxItems value

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

What is the current behavior?

#11353
If user puts cfg maxItems into identify plugin with value for example 15, all new created maps will respect this value but the old ones will not.

What is the new behavior?

All maps [old and new] use the same maxItems limit from the cfg in Identify plugin if existing, providing consistent Identify request behavior across the entire application regardless of when the map was created or saved.

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

- handle ensuring cfg maxItems is always used regardless of saved map settings
@mahmoudadel54 mahmoudadel54 self-assigned this Jul 23, 2025
@mahmoudadel54 mahmoudadel54 linked an issue Jul 23, 2025 that may be closed by this pull request
6 tasks
@tdipisa tdipisa added this to the 2025.01.02 milestone Jul 23, 2025
@tdipisa tdipisa removed their request for review July 23, 2025 15:27
Copy link
Copy Markdown
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works but it is quite convolute, as a workaround.

This will use maxItems configured when it is not saved, solving the problem.
But at the same time, it will ALWAYS save this configuration.maxItems on new maps, ALWAYS IGNORING it and making the configured one have priority.
If there is no configured, the one in the map wins.
Quite tricky but it works.

I think there is a simpler and more maintainable way to solve this problem:

  • Store maxItems outside the configuration on the onInitPlugin'. I see it works like this in MapStore2/web/client/components/data/identify/enhancers/identify.js` :

something like:

onInitPlugin({
                enableInfoForSelectedLayers,
                configuration: {
-                    maxItems
                },
+                maxIems,
                showAllResponses,
                highlight: pluginCfg?.highlightEnabledFromTheStart || false
            });
  • read this variable in the identifyOptionsSelector from mapInfo?.configuration?.maxItems ?? mapInfo.maxItems ?? 10

This solution allows:

  • to set a default for all maps
  • to no allow override by the map, but not saving it.

Of course this may require a little refactor of tests etc... so please evaluate if it is the case.

…tify plugin outside configuration object to avoid save it with map

- edit 'identifyOptionsSelector'
- add/edit unit tests
@offtherailz offtherailz merged commit da37087 into geosolutions-it:master Jul 24, 2025
6 checks passed
@offtherailz
Copy link
Copy Markdown
Member

offtherailz commented Jul 24, 2025

@ElenaGallo, could you please test this on DEV ? Thank you
You can create a context with cfg.maxItems set to 100 in Identify config, then check that in that conext, when querying a layer the request contains feature_count = 100

mahmoudadel54 added a commit to mahmoudadel54/MapStore2 that referenced this pull request Jul 24, 2025
@tdipisa tdipisa added the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Jul 24, 2025
@ElenaGallo
Copy link
Copy Markdown
Contributor

Test passed, @mahmoudadel54 please backport to 2025.01.xx. Thanks

mahmoudadel54 added a commit to mahmoudadel54/MapStore2 that referenced this pull request Aug 1, 2025
@mahmoudadel54
Copy link
Copy Markdown
Contributor Author

Test passed, @mahmoudadel54 please backport to 2025.01.xx. Thanks

Done --> #11373

@tdipisa tdipisa removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

enhancing maxItem handling for Identify requests

4 participants