-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Bug report
If I pass down ctx.ctx.asPath and print it in my <Component /> and then force a HMR, it'll add the protocol+domain+port to the beginning of asPath.
{
"url": {
"query": {},
"pathname": "/",
"asPath": "/"
}
}
// After a bundle rebuild
{
"url": {
"query": {},
"pathname": "/",
"asPath": "http://localhost:3000/"
}
}
To Reproduce
pages/_app.js:
import App, { Container } from 'next/app';
import React from 'react';
export default class MyApp extends App {
static async getInitialProps ({ Component, router, ctx }) {
const { query, pathname, asPath } = ctx;
return { url: { query, pathname, asPath } };
}
render () {
const {Component, url} = this.props;
return (<Container><Component url={url} /></Container>);
}
}
pages/index.js:
export default (props) => <pre>{JSON.stringify(props, null, 2)}</pre>;
Force a bundle rebuild by adding some text and save.
System information
- Version of Next.js: 6.0.3
Other information
As discussed on Slack, it's related to this line.
Metadata
Metadata
Assignees
Labels
No labels