vault backup: 2024-08-28 12:43:53
This commit is contained in:
@@ -1,4 +1,20 @@
|
|||||||
# Work
|
# Work
|
||||||
|
After a lot of head-banging to get this stupid builder.io query to work for the next.js site's PDP to get product-page content, I finally found the answer. The call to builder needs to look like this:
|
||||||
|
```
|
||||||
|
const content = await builder
|
||||||
|
.get('product-page', {
|
||||||
|
query: {
|
||||||
|
data: {
|
||||||
|
logosProductId: `'${logosProductId}'`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
prerender: false,
|
||||||
|
})
|
||||||
|
.toPromise();
|
||||||
|
```
|
||||||
|
The part I couldn't get right was the `query.data.logosProductId` part. The single quotes around the ID appear to be essential.
|
||||||
|
|
||||||
|
I also read up on next.js's app routing because that has effects for when/where (server or client) the data is fetched. The older `getStaticProps` and `getServerSideProps` don't exist anymore. Basically, unless `'use client;'` is set somewhere, it happens on the server.
|
||||||
# Meetings
|
# Meetings
|
||||||
## Commerce Scrum
|
## Commerce Scrum
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user