-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix checking /_app #43
Conversation
src/loader.ts
Outdated
@@ -116,14 +116,14 @@ export default function loader( | |||
// | |||
// This way, the only modified file has to be the _app.js. | |||
if (hasGetInitialPropsOnAppJs) { | |||
return pageNoExt === '/_app' | |||
return pageNoExt.startsWith('/_app') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is that this is not going to work in monorepos...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, maybe yes is fine. If before was just ===
and was working... pageNoExt
is only the page and not all the path... So then yes. This is to fix these cases /_app.page.ts
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a fix for _app.page.tsx
- custom pageExtensions
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! LGTM. The only thing... can you add a test similar than this?
next-translate-plugin/__tests__/loader.test.js
Lines 66 to 79 in 60c4ee7
it('should return templateWithHoc', () => { | |
mockHasStaticName.mockReturnValueOnce(true) | |
const code = ` | |
import withSomeHoc from 'some-hoc' | |
export default function Page() { | |
return <h1>Page</h1> | |
} | |
Page.getInitialProps = () => ({ props: {} }) | |
` | |
loader.call({ ...config, resourcePath: 'pages/some-page.ts' }, code) | |
expect(mockTemplateWithHoc).toBeCalled() | |
}) |
Thanks!!
Okay, done, @aralroca |
@TheMatrixan thanks for your contribution. Your code is already available in 2.5.3-canary.2 prerelase |
Fixes: #35 aralroca/next-translate#1116
[ ] Documentation update
[+] Bug fix
[ ] New feature
[ ] Other, please explain:
What changes did you make? (Give an overview)
Which issue (if any) does this pull request address?
Is there anything you'd like reviewers to focus on?