question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with Page Transitions

See original GitHub issue

Hello,

First, thank you for this amazing library.

I’m experimenting this issue with any page transitions library eg. next-page-transitions framer-motion etc. Problem is that translation namespace is changed before animation finish:

<PageTransition timeout={1500} classNames='page-transition'>
  <Component {...pageProps} key={router.route} />
</PageTransition>

Note*: I set 1500 of delay to make more evident de issue, even without timeout effect is the same.

chrome-capture (1)

Is there a way to wait animation finish before load the namespace translation?

Thank you

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
haydenclearycommented, Feb 16, 2021

@josegutierro my bad! Just remembered the real fix that worked for me. I found this wrapper online that allows the translations to persist. You should just need to import this hook instead of next-translate, hope it helps.

import { useMemo } from "react";
import useNextTranslation from "next-translate/useTranslation";

/*
	This wrapper hook is so the translations persist through the page animations.
	Otherwise the route is considered different and next-translate will change the translation file before the animation has finished.
*/

export default function useTranslation(namespace, options) {
	const { t, lang } = useNextTranslation(namespace, options);
	const T = useMemo(() => t, [lang]);
	return { t: T, lang };
}
2reactions
aralrocacommented, Apr 8, 2021

@josegutierro @haydencleary I did a PR to include this inside the useTranslation hook, this way you do not need a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Re: Problems with Page Transitions - 12911752
I have created an interactive document with page transitions. The document has buttons, animations, and other media. The problem is two fold ......
Read more >
Problem with Page Transitions · Issue #513 - GitHub
I'm experimenting this issue with any page transitions library eg. next-page-transitions framer-motion etc. Problem is that translation namespace is changed ...
Read more >
How To Solve The Page Transitions Conflict premium
When page transitions are turned on, the header and the footer are not reloaded, in fact, only the content gets reloaded. This can...
Read more >
Improving User Flow Through Page Transitions
Transitions between pages can enhance the experience by retaining (or even improving) the user's context, maintaining their attention, and ...
Read more >
Fullscreen Page transitions in PDFs no longer work
This is an absolute no-go for a professional software. Please finally talk to Apple and solve the problem! (The attached PDF file shows...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found