-
Notifications
You must be signed in to change notification settings - Fork 30.2k
Closed
Description
Bug report
Describe the bug
The getInitalProps function does not seem to be running on page reload.
I'm trying to pull the id from this path /approaches/view?id=319, it works when I navigate using links, but once I refresh the page the asPath property is now the path without the query, and the query itself is gone. Any ideas?
const ApproachView = props => <TagView {...props} type="approach" plural="approaches" />;
// ApproachView.getInitialProps = async ({ query: { id }, asPath }) => ({ id, asPath });
ApproachView.getInitialProps = async ctx => {
console.log('get initial props ran!!');
return { id: ctx.query.id };
};
export default ApproachView;
To Reproduce
Just reloading the page
Expected behavior
Query and path props should persist on reload
System information
- OS: Linux
- Browser: Chrome
- Version of Next.js: 8.0.3
mudin
Metadata
Metadata
Assignees
Labels
No labels