How to properly render a server side pagination in Storybook? #539
-
We are working with Storybook to visualize our components before using them on the pages. We created our Pagination component using the example, specifically the server-side one, and we are trying to render it on Storybook, but it fails with the following error: Error
[nuqs] Empty search params cache. Search params can't be accessed in Layouts.
See https://err.47ng.com/NUQS-500
Call Stack
all
navigation-Pagination-Pagination-stories.iframe.bundle.js:682:13
Pagination
navigation-Pagination-Pagination-stories.iframe.bundle.js:452:105
renderWithHooks
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:125385:27
mountIndeterminateComponent
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:131146:13
beginWork$1
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:132746:16
callCallback
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:134862:14
invokeGuardedCallbackImpl
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:134911:16
invokeGuardedCallback
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:134986:29
beginWork
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:141177:28
performUnitOfWork
vendors-node_modules_pnpm_faker-js_faker_8_4_1_node_modules_faker-js_faker_dist_esm_index_mjs-c99bd3.iframe.bundle.js:140001:12 From the documentation, we understand we need to mock something, but, what is it? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
According to the error URL, the issue is that the search params cache hasn't been populated. This can be done by calling the Documentation: https://nuqs.47ng.com/docs/server-side |
Beta Was this translation helpful? Give feedback.
According to the error URL, the issue is that the search params cache hasn't been populated. This can be done by calling the
parse
method on it, feeding it your mock search params, which will then be distributed to the RSC tree.Documentation: https://nuqs.47ng.com/docs/server-side