bcgov / api-services-portal

API Services Portal provides a multi-tenant frontend integrating API Gateway and Authorization services from Kong CE and Keycloak.
https://api.gov.bc.ca
Apache License 2.0
22 stars 7 forks source link

Clicking on gateway list entry doesn't always redirect #1122

Open Elson9 opened 1 month ago

Elson9 commented 1 month ago

API Services Portal Issue

User Story

As an API Provider, I want to reliably select a Gateway and have it redirect to the detail page every time.

Test Case

ENV

TESTCASE

EXPECTED

ACTUAL

ERROR

Notes

timng-bcgov commented 1 month ago

I noticed that I only experience this issue the first time I select a Gateway from the list after I log in as a provider. Also, the toast pops up and I can see the URL/title metadata update briefly as well. Any subsequent navigation after refreshing the page or browsing elsewhere in the portal is OK.

rustyjux commented 1 month ago

This issue can occur in local env (docker compose) as well as dev. It is difficult to reproduce consistently.

I also observe what @timng-bcgov noted re: page title updating and then going back as it was. I didn't see the URL change but maybe my eyes are too slow.

My guess is either: A) some server side content is not readily available so the redirect fails, or B) there is a race condition where the router.push doesn't occur.

To address B) I tried adding an await on that in https://github.com/bcgov/api-services-portal/commit/6e1c3f5c90ece01e36747f893a704a409a8d42fc and it seems to be working in detached local dev mode. I will validate with more testing in docker compose and in dev.

rustyjux commented 1 month ago

Following the await change, I could not reproduce the bug in a handful of tests on dev and local docker.

I think we are good so I am going to close. If the bug continues to occur, I will set up a quick automated test to better validate any future fixes.

rustyjux commented 3 weeks ago

Still occurs in the current release in test (b902ab05f)

rustyjux commented 2 weeks ago

Still not resolved. The problem (which was attempted to resolve in #1146) ties back to NoGatewayRedirect pushing users back to list.

@Elson9 has suggested a 1 second setTimeout() or sleep() as a last resort.

I think if paired with some sorta visual loading something it might not be so bad. In general people shouldn't end up on a Gateways page without an active gw (except after logging back in).

What is not uncommon is people going from list --> detail so we really need to fix that.

A more polished solution for users logging in to a Gateways page (and being redirected away now) would be to add a query param to reactivate the last Gateway they were using.

rustyjux commented 2 days ago

It's back! Still need more work on this issue. If you rapidly go Gateways > Gateway detail > Gateway Services (or other subpage), the redirect back to Gateways occurs: Recording 2024-09-12 at 15 57 00