-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I'm seeing some problems in the build phase of our app that uses this lib. Everything runs fine in dev mode, but during the compile phase it spews some errors, and build isn't getting the "common props" at all.
I've set up my config like this…
module.exports = function () {
const queries = {
'/index': [
{
key: 'menu',
data: async () => {
console.log('init')
const data = await sanityClient.fetch(menuQuery, { slug: 'overflow' })
console.log('retrieved')
return data
},
},
]
}
return queries
}
… and in the consumer component…
const { common } = useCommonProps()
if (!common['menu']) {
throw new Error(`useCommonProps cannot find 'menu'`)
}
When I run yarn dev, my terminal outputs something like this…
$ next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- info Loaded env from /Users/wvgg/Sites/boutique-homes/charlie/apps/consumer/.env
- event compiled client and server successfully in 107 ms (18 modules)
- wait compiling...
- event compiled client and server successfully in 74 ms (18 modules)
- wait compiling /_error (client and server)...
- event compiled client and server successfully in 1700 ms (458 modules)
Error: useCommonProps cannot find 'menu'
at OverflowMenu (webpack-internal:///./src/components/overflowMenu/index.tsx:42:97)
at renderWithHooks (/Users/wvgg/Sites/boutique-homes/charlie/node_modules/react-dom/cjs/react-dom-server.browser.development.js:5658:16)
// BIG LONG STACK TRACE
- warn Fast Refresh had to perform a full reload. Read more: https://nextjs.org/docs/messages/fast-refresh-reload
- wait compiling / (client and server)...
- event compiled client and server successfully in 1332 ms (912 modules)
init
retrieved
Similar results on yarn build, except I never even see retrieved.
My best guess is that NextJS (13.4.9) is plowing forward with the build before the promises in the config are fulfilled — possibly a new release optimization doesn't play well with the package?
Any advice or insight you could offer would be greatly appreciated.
[addendum: this code has been working fine since April; then this glitch showed up about one month ago.]