Skip to content

Conversation

cesnietor
Copy link
Collaborator

@cesnietor cesnietor commented Jun 13, 2023

Description:

Refactors the way we were calling /session api since previous implementaiton was making multiple requests (up to six) which could mean high latency if that requests take time to resolve. Now we call it only once and only at initial load.

Changes:

  • created Session thunk to control Session API state
  • Create new state in consoleSlice to store the session state (loading, done, etc)
  • Updated Loging.tsx to default to /browser to avoid redirecting first to / and then to /browser when logging in.

Before:
Screenshot 2023-06-12 at 10 50 46 PM

After:
Screenshot 2023-06-12 at 11 05 27 PM

If navigating between tabs it won't call session api.
Screenshot 2023-06-13 at 1 59 49 PM

Test Steps:

Scenarios:

  • With a minio running on port 9000, make assets and then make the binary make assets && make then run it on port 9090 like:
CONSOLE_ACCESS_KEY=minioconsole
CONSOLE_SECRET_KEY=minioconsole
CONSOLE_MINIO_SERVER=http://localhost:9000
CONSOLE_DEV_MODE=on ./console server
  • Can login with valid user and the amount of calls to /session api are not more than one.
  • Navigate between tabs (we should call /session only ONCE at initial load of whole page)
  • Anonymous access works without issues (create bucket, set anonymous access to it [path /] and try to access to it without loging in). Everything should work just fine.

prakashsvmx
prakashsvmx previously approved these changes Jun 13, 2023
Copy link
Member

@prakashsvmx prakashsvmx left a comment

Choose a reason for hiding this comment

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

Tested. Changes look good to me. 👍

@dvaldivia
Copy link
Collaborator

Seeing a session call every time I navigate @cesnietor
Screenshot 2023-06-13 at 9 21 21 AM

@cesnietor
Copy link
Collaborator Author

cesnietor commented Jun 13, 2023

@dvaldivia yes it was like that already before. I mentioned it in the description of the ticket as well.

@jinapurapu
Copy link
Contributor

jinapurapu commented Jun 13, 2023

Session is being called twice on Bucket Details screen and on first load of Settings screen
Screenshot 2023-06-13 at 12 32 59 PM
Screenshot 2023-06-13 at 12 45 55 PM

reivaj05
reivaj05 previously approved these changes Jun 13, 2023
@cesnietor
Copy link
Collaborator Author

@prakashsvmx @reivaj05 @dvaldivia @jinapurapu I've updated the PR addressing the comments and also doing the following -> We will no longer call /session api on every change path since it's a bit expensive (even if the api resolves quickly). More comments in the thread above with Daniel

@cesnietor
Copy link
Collaborator Author

rebased.

@cesnietor cesnietor merged commit 253053c into minio:master Jun 13, 2023
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.

5 participants