prezly / theme-nextjs-bea

News site built with NextJS, Typescript and Prezly SDK
https://theme-nextjs-bea-the-good-newsroom.vercel.app
MIT License
43 stars 11 forks source link

[DEV-12776] Fix - Story UUID is not passed into analytics context provider #1126

Closed kudlajz closed 4 months ago

kudlajz commented 4 months ago

This is a bit of a hacky solution but I've spent quite some time on this already and couldn't find a better solution without majorly rethinking the whole analytics package.

By using the debounced function (which uses timeout), the page call is only triggered after the contexts are updated and components are re-rendered, making it so that all the data is up to date.

In order for this solution to work, it requires disabling automatic page tracking that I've prepared in https://github.com/prezly/analytics/pull/299.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
theme-nextjs-bea-preview ✅ Ready (Inspect) Visit Preview Apr 10, 2024 11:57am
3 Ignored Deployments | Name | Status | Preview | Updated (UTC) | | :--- | :----- | :------ | :------ | | **theme-nextjs-bea-cookbook** | ⬜️ Ignored ([Inspect](https://vercel.com/prezly/theme-nextjs-bea-cookbook/TVYzWddLPqdcbnV4pkosfwmvyvzQ)) | | Apr 10, 2024 11:57am | | **theme-nextjs-bea-photography** | ⬜️ Ignored ([Inspect](https://vercel.com/prezly/theme-nextjs-bea-photography/A5P351Gz2gsLxB4AK7JNvbAKEf4G)) | | Apr 10, 2024 11:57am | | **theme-nextjs-bea-the-good-newsroom** | ⬜️ Ignored ([Inspect](https://vercel.com/prezly/theme-nextjs-bea-the-good-newsroom/5VNh2zGRwpgKvwKTpAPTt8ynC4M1)) | | Apr 10, 2024 11:57am |
kudlajz commented 4 months ago

OMG, I forgot to update the analytics package first. Will have to revert 🙈

kudlajz commented 4 months ago

Okay, not reverting but will fix it in https://github.com/prezly/theme-nextjs-bea/pull/1127 before merging. I've canceled the deployment at least.