#are you sure the page that are utilising

1 messages · Page 1 of 1 (latest)

edgy spindle
#

I have nextjs console output next to me. I see that it does the fetch. I call a function within unstable_cache without any params and a static cache key.

worldly gale
#

uhh that doesnt answer my question, sorry

edgy spindle
#

Yes, I see and know it is not statically generated.

worldly gale
#

how do you have it set up?

edgy spindle
#

I use app directory. There is a product page. It calls a service which gets data using 3rd party library. Even though other calls are not cached for a reason and I see those get called every time on the same product page, the unstable cache loads only once per product page. If switch to other product or other kind of page where that cache is used, it calls the 3rd party lib once.

#

running pnpm build and then pnpm start, so I am not in dev mode.

#

Anyway, I switched to 3rd party caching library since it works and in addition it has some additional features so I'm probably not going to spend more time on it now. I just wanted to know if it doesn't work for me or it's by design. Thank you for your time!

worldly gale
#

🥺

#

i swear i will not spend your time

edgy spindle
#
import { unstable_cache as cached } from 'next/cache'
  //...
  private async getCategories() {
    return cached(this.loadCategoriesFromServer, ['categories'], {
      revalidate: 600,
      tags: ['categories'],
    })()
  }
#

and loadCategoriesFromServer is a private async method of the class.

#

Maybe it doesn't like that it's a class method and not a simple function? 🤷‍♂️

worldly gale
#

Thank you for you time, as i said, i wondt spend ur time anymore 😭