Closed silveltman closed 11 months ago
Update, even when simply trying the render a Bookshop component with the incorrect props gives the exact same error. I'm simply doing this:
<Hero />
this is my bookshop.yml:
# The spec section names this component and tells CloudCannon where you can place this component on your site.
spec:
structures:
- blocks
label: Hero
description: A hero component
icon: nature_people
# The blueprint section defines the data your component needs and provides the default values when a new component is created.
blueprint:
writeup: Hello title!
# The preview section is used in the Bookshop component browser and doesn't affect visual editing. We can ignore this key for now
preview:
# The _inputs section is passed through as CloudCannon's input configuration, allowing you to customize the fields specified in the blueprint.
_inputs:
It worries me very much, because even when I remove the bookshop.yml file, I get the same bookshop error. No astro error!
complete log:
error Cannot read properties of undefined (reading '__bookshop_path')
File:
/Users/silveltman/Documents/Github/monorepo-astro/library/src/components/blocks/hero/Hero.astro:113:21
Stacktrace:
TypeError: Cannot read properties of undefined (reading '__bookshop_path')
at eval (/Users/silveltman/Documents/Github/monorepo-astro/library/src/components/blocks/hero/Hero.astro:113:21)
at eval (/Users/silveltman/Documents/Github/monorepo-astro/library/src/components/blocks/hero/Hero.astro:120:9)
at eval (/Users/silveltman/Documents/Github/monorepo-astro/library/src/components/blocks/hero/Hero.astro:122:5)
at AstroComponentInstance.Hero [as factory] (/Users/silveltman/Documents/Github/monorepo-astro/library/node_modules/astro/dist/runtime/server/astro-component.js:18:12)
at AstroComponentInstance.init (/Users/silveltman/Documents/Github/monorepo-astro/library/node_modules/astro/dist/runtime/server/render/astro/instance.js:33:29)
at AstroComponentInstance.render (/Users/silveltman/Documents/Github/monorepo-astro/library/node_modules/astro/dist/runtime/server/render/astro/instance.js:38:18)
at Object.render (/Users/silveltman/Documents/Github/monorepo-astro/library/node_modules/astro/dist/runtime/server/render/component.js:328:22)
at Module.renderChild (/Users/silveltman/Documents/Github/monorepo-astro/library/node_modules/astro/dist/runtime/server/render/any.js:29:17)
I error goes way when disabling the bookshop() integration.
Temporary fix:
const {
section = {},
segment = {},
writeup,
group = {},
buttons,
image,
} = Astro.props
Doest fix the main problem, the error handling, though
Hey Sil 👋
I'll have a dig into this tomorrow (with our peeps who know more about Astro's internals) and get you an answer 🙂
Hey Sil — a release has landed today which hopefully resolves things for you!
https://github.com/CloudCannon/bookshop/releases/tag/v3.8.2
Give that a crack and let me know if not 🙂
@bglw thats fast, great!
I don't see 3.8.2 published to NPM yet though, correct?
My bad! CI woes.
Published now :)
Problem seems to have disappeared 👍
Will let you know if something like this pops up again
I'm getting the following error in my astro project:
error Cannot read properties of undefined (reading '__bookshop_path')
This gives the error:
Like this it works fine:
And like this it works fine too:
The weird thing is that it only give the bookshop error, no astro error.
The Hero (parent component) is a bookshop component and rendered via the example in the Astro bookshop docs.
The child Section can be either a bookshop component or not, same error