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 renaming block #331

Closed mehmetc closed 11 months ago

mehmetc commented 11 months ago

I'm new to SvelteKit still do not understand the inner mechanics and reasoning behind it my apologise for my ignorance. I'm running Primo locally in a container. The query id parameter is the block(symbol) object instead of the id no other payload is submitted.

In /src/routes/[site]/+layout.svelte

    } else if (action === 'update') {
      res = await supabase.from(table).update(data).eq('id', id)

data is empty and id contains the symbol object.

request

https://xxx.supabase.co/rest/v1/symbols?id=eq.%5Bobject+Object%5D

response

{"code":"PGRST102","details":null,"hint":null,"message":"Error in $: not enough input"}

request

fetch("https://xxx.supabase.co/rest/v1/symbols?id=eq.%5Bobject+Object%5D", {
  "headers": {
    "accept": "*/*",
    "accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
    "apikey": "aKey",
    "authorization": "Bearer aToken",
    "cache-control": "no-cache",
    "content-profile": "public",
    "content-type": "application/json",
    "pragma": "no-cache",
    "prefer": "",
    "sec-ch-ua": "\"Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"115\", \"Chromium\";v=\"115\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "cross-site",
    "x-client-info": "@supabase/auth-helpers-sveltekit@0.8.7"
  },
  "referrer": "http://127.0.0.1:16000/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "PATCH",
  "mode": "cors",
  "credentials": "include"
});

stacktrace

window.fetch @ http://127.0.0.1:16000/_app/immutable/entry/start.903b5f7f.js:88
(anonymous) @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3847
(anonymous) @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3868
fulfilled @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3820
step @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3833
(anonymous) @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3835
__awaiter$5 @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3817
(anonymous) @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:3858
then @ http://127.0.0.1:16000/_app/immutable/chunks/supabase.e1f3f20b.js:705
mateomorris commented 11 months ago

Thanks! Caused by a recent refactor to the symbols. Pushing the fix now.

mateomorris commented 11 months ago

@mehmetc same here, go ahead & sync your fork & try again

mehmetc commented 11 months ago

Thank you! I works. Just a side note I had to bump the version for "@primocms/builder" from "^0.0.42" to "^0.1.1".