next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Handling node page updates?

Open iamfredrik opened this issue 3 years ago • 6 comments

I'm quite new to this so I'm probably doing something wrong as I can't get the production site to fetch node updates. The preview mode works just fine and shows the updates, but when I visit the actual url in a browser window it just shows the old version. I'm using the basic starter so is there some setting I need to change in order to get it to fetch the updated node or do I have to rebuild the project every time some text is changed?

iamfredrik avatar Sep 28 '22 06:09 iamfredrik

@iamfredrik did you implement on-demand revalidation?

We have a guide here: https://next-drupal.org/guides/on-demand-revalidation

shadcn avatar Sep 28 '22 06:09 shadcn

Thanks, I didn't have the Next Extras module installed and configured. However, is it possible to add a wildcard to the paths setting or do I have to define every path that needs to update separately? I tried adding /* but it didn't work.

iamfredrik avatar Sep 28 '22 06:09 iamfredrik

Unfortunately no. Next.js on-demand ISR does not have support for wildcards.

There are a few other ways you can handle dynamic content across pages. Can you tell us more what you're trying to revalidate?

PS: We're looking into a solution for revalidating multiple pages in next-drupal.

shadcn avatar Sep 28 '22 07:09 shadcn

Let's say I add a new page with a menu link, then the link won't show up on every page unless I revalidate them all. Without revalidation the link is only visible on the newly created page. Same thing if the link is already on every page and I edit the link, then the change only shows on the edited page. Is there a solution for this?

iamfredrik avatar Sep 28 '22 07:09 iamfredrik

If you have menu links that are updated often, you can implement dynamic menus.

I added an example here: https://github.com/shadcn/next-drupal-examples/tree/main/example-dynamic-menus

The menu items will be fetched on the first page hit only, then cached for subsequent navigation.

shadcn avatar Sep 28 '22 07:09 shadcn

If you have menu links that are updated often, you can implement dynamic menus.

I added an example here: https://github.com/shadcn/next-drupal-examples/tree/main/example-dynamic-menus

The menu items will be fetched on the first page hit only, then cached for subsequent navigation.

Thank you.

iamfredrik avatar Sep 28 '22 09:09 iamfredrik