Skip to content

fix(api-manager): open the metrics stream on first load without replaceState - #13

Open
hongwei1 wants to merge 1 commit into
OpenBankProject:mainfrom
hongwei1:fix/metrics-grpc-default-replacestate
Open

hongwei1 wants to merge 1 commit into
OpenBankProject:mainfrom
hongwei1:fix/metrics-grpc-default-replacestate

Conversation

@hongwei1

Copy link
Copy Markdown
Contributor

On first load the API Manager metrics page picks its transport from ?transport= or, when the OBP API (gRPC) health check is up, defaults to gRPC. In that case it now sets the transport and opens the gRPC stream directly, and the URL gets transport=grpc from the submitQuery navigation that follows, since SvelteKit's replaceState can only run once the router has started. Switching with the REST/gRPC toggle still writes the choice into the URL with replaceState, so reloads and shared links keep it.

The new component tests in metrics/page.svelte.test.ts render the page and check that a gRPC default opens the stream without calling replaceState, that ?transport=grpc does the same, that REST opens no stream, and that the toggle updates the URL. They run in the client test project, which now has the vitest-setup-client.ts its config referenced (the missing test/setup.ts entry is dropped). vitest --run in apps/api-manager: 13 files, 106 tests pass.

…ceState

When gRPC is the default transport, the metrics page now sets it and connects the stream directly on first load and leaves the URL to submitQuery, because SvelteKit's replaceState can't run before its router has started. Switching transport with the toggle still records the choice in the URL. Adds component tests for the page and the client test setup file the config already referenced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant