jamestagal / plenti-educenter

0 stars 1 forks source link

Error when adding stats.svelte component to aboutus.json #10

Closed jamestagal closed 1 year ago

jamestagal commented 1 year ago

Hi @jimafisk I have made this a separate issues because as I already have asked a question about a different issue in TODOs issue queue I didn't want to confuse things too much.

I have a pages content type with an aboutus.json file inside it and I am using a few different components to build the content for this page. Today, I realised that there was text still sitting in the html markup in the stats.svelte file. So I did the usual step and imported the json keys from the aboutus.json file, see commit, and did the replacement pattern in the markup of these keys in stats.svelte file.

After that for some reason, I got the following error:

Error in DataSource build step
Can't create props for content/pages/aboutus.json 
Can't render htmlComponent for layouts_content_pages_svelte
TypeError: Cannot read property 'amount' of undefined
    at create_ssr:21:168
    at Object.$$render (create_ssr:1555:22)
    at create_ssr:14:168
    at each (create_ssr:1521:16)
    at create_ssr:14:12
    at Object.$$render (create_ssr:1555:22)
    at create_ssr:30:73
    at $$render (create_ssr:1555:22)
    at Object.render (create_ssr:1563:26)
    at create_ssr:1:58

I have looked over the code many times and can't see any issue. Please have a look when you can. Maybe a fresh pair of eyes will help. 👀 NOTE: To stop causing the build to fail, I have misspelt the name of this component in the aboutus.json as stat to exclude it.

Ben

jamestagal commented 1 year ago

Hi @jimafisk I worked out this issue. I have a typo in one of the fields. The error message through me off because it wasn't amount that was undefined it was a different field. I will close this issue 😄