bhaskargurram-ai opened a new pull request, #725:
URL: https://github.com/apache/shenyu-dashboard/pull/725

   Fixes #724.
   
   On the Instance page, `componentDidMount` fetches both the table and the 
analysis charts. On a namespace change, `componentDidUpdate` only called 
`query()`, so the charts kept the previous namespace's data under the new 
namespace's table.
   
   Changes:
   - `componentDidUpdate` now calls `queryAnalysis()` as well as `query()` when 
the namespace changes.
   - The instance model records which namespace the charts belong to 
(`analysisNamespaceId`). When the analysis for a different namespace starts 
loading, it clears the charts first, so they show the "no data" state while 
loading and if the request fails, not the old namespace's numbers. Refreshing 
the same namespace doesn't clear them.
   - `fetch` and `fetchAnalysis` drop a response when its namespace is no 
longer the selected one (`global.currentNamespaceId`), so a slow request for 
namespace A can't overwrite B's table or charts after a switch.
   
   Tests:
   - `src/models/instance.test.js` runs the effects against a mocked store: 
switching A to B (charts cleared, then B's data saved), refreshing the same 
namespace (not cleared), an analysis response arriving after a switch 
(dropped), a failed request (charts stay cleared), a table response arriving 
after a switch (dropped), and the reducer storing the namespace.
   - `src/routes/System/Instance/namespaceSwitch.test.js` checks that a 
namespace change dispatches both `instance/fetch` and `instance/fetchAnalysis` 
for the new namespace.
   
   All 7 new tests fail on master and pass with the change. The full jest run 
passes (58 suites, 288 tests). eslint has no errors (the 3 warnings were there 
before), and prettier is clean. I checked this with unit tests only, not in a 
browser against a running admin. The backend aggregation in apache/shenyu#7695 
and the bundled dashboard update in the main repo are separate from this PR


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to