feat(core): add new entry to Plugin type for centralised query param handling#1967
feat(core): add new entry to Plugin type for centralised query param handling#1967tadayosi wants to merge 1 commit intohawtio:mainfrom
Conversation
|
@grgrzybek Please review it |
5afead2 to
48a6988
Compare
|
cc @pseudaverse |
grgrzybek
left a comment
There was a problem hiding this comment.
Actually only questions and comments.
Looks great - should be a good base for future extensions.
Test Results2 files ± 0 2 suites ±0 2m 34s ⏱️ - 6m 52s For more details on these failures, see this check. Results for commit 000a7d2. ± Comparison against base commit cf906b6. This pull request removes 82 tests.♻️ This comment has been updated with latest results. |
Test resultsRun attempt: 5557
|
|
The one small problem imo: when you click back to jmx plugin, tree is rendered with some selected node but nid is missing. |
48a6988 to
7017534
Compare
|
@pseudaverse I'd say it's an expected behaviour. There is no guarantee that the node selection is preserved between plugins. Plugins may use a specific part of the MBean tree for different purposes, and for some plugins the |
b4cc446 to
6ffbecd
Compare
568c727 to
3d3460a
Compare
3d3460a to
000a7d2
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces centralized URL query-parameter filtering at the main Hawtio page level so that only recognized/common parameters (and plugin-specific ones) remain in the URL during routing, aiming to prevent navigation issues caused by “stale”/irrelevant query params.
Changes:
- Added a
useEffectinHawtioPageto strip unknown query parameters before rendering a plugin view. - Updated plugin route generation to reuse a created element for the parent route and its
*child route. - Introduced a shared list of common, globally-allowed query params via
KNOWN_COMMON_QUERY_PARAMS.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const knownParams = new Set([...KNOWN_COMMON_QUERY_PARAMS, ...(plugin.knownQueryParams ?? [])]) | ||
| searchParams.forEach((_, key) => !knownParams.has(key) && searchParams.delete(key)) | ||
| setSearchParams(searchParams) |
There was a problem hiding this comment.
this still triggers a navigation/update and can cause a re-render loop
setSearchParams() is a state update call and when there's no change, there's no re-render...
but I'd have to see under debugger.
| return | ||
| } | ||
|
|
||
| const plugin = plugins.find(p => p.path && pathname.startsWith(p.path)) |
Fix #903
With this enhancement, the new param
nidis only effective within JMX plugin. It should be fine for now. We can later extend the feature to other selected node-based plugins such as Camel and Quartz under separate issues.