primocms / primo

Primo is a visual CMS with a built-in code editor, Svelte blocks, and static site generator.
https://primocms.org
MIT License
1.92k stars 474 forks source link

Error on saving block #323

Closed SpyrexDE closed 11 months ago

SpyrexDE commented 11 months ago

I am currently building a TimeLine Block for primo. The first time I saved it nothing happened but from there on resaving gives me this error: image

This is the block I was trying to edit: TimeLine.json.zip

mateomorris commented 11 months ago

@SpyrexDE I'm assuming this is the newest version? I pushed a couple updates late last night - you should have seen a "database change required" notice

SpyrexDE commented 11 months ago

I just updated my fork. I got no notice like that and when I open my site I get the following error on the server, probably due to these database changes:

TypeError: Cannot read properties of null (reading 'map')
    at file:///var/task/.svelte-kit/output/server/entries/pages/_site_/_layout.svelte.js:560:32
    at Object.$$render (file:///var/task/.svelte-kit/output/server/chunks/index3.js:305:18)
    at Object.left (file:///var/task/.svelte-kit/output/server/entries/pages/_site_/_layout.svelte.js:673:121)
    at file:///var/task/.svelte-kit/output/server/entries/pages/_site_/_layout.svelte.js:330:78
    at Object.$$render (file:///var/task/.svelte-kit/output/server/chunks/index3.js:305:18)
    at file:///var/task/.svelte-kit/output/server/entries/pages/_site_/_layout.svelte.js:650:66
    at Object.$$render (file:///var/task/.svelte-kit/output/server/chunks/index3.js:305:18)
    at file:///var/task/.svelte-kit/output/server/entries/pages/_site_/_layout.svelte.js:740:210
    at Object.$$render (file:///var/task/.svelte-kit/output/server/chunks/index3.js:305:18)
    at Object.default (file:///var/task/.svelte-kit/output/server/chunks/internal.js:72:119)

What do I have to change about the database?

mateomorris commented 11 months ago

Just need to add a column to the 'symbols' table to enable rearranging blocks in the sidebar. Instructions are in the changelog: https://primocms.org/changelog

mateomorris commented 11 months ago

Okay @SpyrexDE should be fixed now. When you update it should show you the notice with instructions for adding the column to Supabase.

SpyrexDE commented 11 months ago

Okay @SpyrexDE should be fixed now. When you update it should show you the notice with instructions for adding the column to Supabase.

That fixed it, thank you :)

mateomorris commented 11 months ago

Great! Sure thing 😄

SpyrexDE commented 11 months ago

Sorry looks like for some reason the same bug came up again 😫

image

And this error as well: image

Im using the newest version.

mateomorris commented 11 months ago

ah. Could you share the primo.json file from your site? It'll be in the site's repository. Also, what do you mean by "saving the site"?

SpyrexDE commented 11 months ago

Sorry I meant saving the block: TimeLine.json.zip It also seems to only happen with the timeline block. My other custom blocks have no issues saving.

mateomorris commented 11 months ago

@SpyrexDE looks like something happened to that block's content. When did you create it? This one should work: TimeLine 2.json.zip

SpyrexDE commented 11 months ago

@mateomorris I created it on the same day I created this issue. You mean the missing "en": {} may have caused the problem? It looks like readding it solved my problem for now but I wouldn't be surprised if it would come up again soon :/

mateomorris commented 11 months ago

@SpyrexDE yeah, but I discovered what was causing it & pushed an update last night: https://github.com/primocms/builder/commit/3fec11c8feef7d0afb6b7d31180b5745d00b6281

When you create new symbols now it shouldn't have that issue

SpyrexDE commented 11 months ago

@mateomorris I updated my fork and worked on the block a few more hours and I never had the issue again. Seems to be fixed now :D

mateomorris commented 11 months ago

Okay great 👍