Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload of app on RouteNavItem #25

Open
charlesfrancisco opened this issue Feb 10, 2018 · 1 comment
Open

Reload of app on RouteNavItem #25

charlesfrancisco opened this issue Feb 10, 2018 · 1 comment

Comments

@charlesfrancisco
Copy link

Hello,
Thanks for a great tutorial.
For those who want to use the components in an application, I have noticed a small glitch on the RouteNavItem component:
The onclick is overriden without a preventDefault which leads to both a standard navigation on the link and get on the server as well as the history push. This causes the page to be loaded as well, loosing the AWS.config.credentials, leading to a retrieval of the credentials from storage and refresh of the token at every navigation from a navbar link plus aborted APIG calls as the page reloads while executing.
On the current app this effect is limited as navigations are mostly programmatic (e.g. login page redirect to home, note detail opening/editing) but can still be noted from a note, navigating to the home page.
For expanded apps with several menus with APIG initial loading, the effect will be far more noticeable with APIG

alert messages popping out and a luggish load of the containers (done twice).

I would suggest the following change on RouteNavItems.js (12):

    onClick={e => {e.preventDefault(); history.push(e.currentTarget.getAttribute("href"));}}

only the push is executed, removing issues of server back and forth and aborted APIG calls.
Hope it helps.
Cheers,
Charles

@jayair
Copy link
Member

jayair commented Feb 12, 2018

@charlesfrancisco I'm guessing there was an update to one of the dependencies. Since this wasn't an issue before - https://demo.serverless-stack.com. Can you share your package.json so I can check what is going on?

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

No branches or pull requests

2 participants