Open wrongakram opened 5 years ago
Hey @akramk22 , maybe this merged PR fixes your issue: https://github.com/postlight/headless-wp-starter/pull/198
@alexiakl Updated the src folder to contain the changes. However still not having any luck. Page to Page fetching isn't updating for me :(
Yep, I experience the same problem. Also, I found a bug in header-menu.php. A function that pulls menu items is based on menu name so if user change name of it in CMS, everything stops working. I made a small tweak and make it relay on location no menu name.
function get_items() {
$counter = 0;
$locations = get_nav_menu_locations();
$object = wp_get_nav_menu_object( $locations['header-menu'] );
$menu_items = wp_get_nav_menu_items( $object->name );
foreach ( $menu_items as $item ) {...}
}
@akramk22 I found a solution to your menu problem: You need to add this to Post.js and a similar thing to Page.js:
componentDidUpdate(prevProps) {
if (this.props.match.params.slug !== prevProps.match.params.slug) {
this.executePostQuery();
}
}
Whenever I navigate from a page to another page it doesn't pull the "new" page content. Correct content is only generated when I go from a post to a page or home to a page. I will try to find a solution in the mean time.