lovasoa / SQLpage

SQL-only webapp builder, empowering data analysts to build websites and applications quickly
https://sql.ophir.dev
MIT License
883 stars 64 forks source link

No error message is displayed when the dynamic component is called with invalid json #314

Closed guspower closed 1 month ago

guspower commented 1 month ago

Introduction

I have been successfully setting the shell title from a json file as per the docs. As of the latest release (v0.20.5) neither the custom title or footer are being displayed.

To Reproduce

Follow a pattern similar to the docs:

index.sql

SELECT 'dynamic' AS component, sqlpage.read_file_as_text('shell.json') AS properties;

shell.json

{
  "component": "shell",
  "title": "Custom Title",
  "link": "/",
  "language": "en-GB",
  "description": "Custom description",
  "font": "Poppins",
  "icon": "book",
  "footer": "Custom Footer 2024"
}

Actual behavior

Instead SQLPage renders the default title and footer.

Expected behavior

The custom shell should be output into the browser.

Version information

lovasoa commented 1 month ago

Hi @guspower ! Can you please provide reproduction steps ? Everything seems to work fine for me.

Here is a replit with the exact shell you are mentioning, which works: https://replit.com/@pimaj62145/SQLPage-dynamic-shell-exemple#index.sql

guspower commented 1 month ago

Apologies for raising a bug on Monday morning, I should've figured it was user error. Sigh.

It turns out there was a trailing comma in the shell.json, e.g. if you have something like:

{
  "component": "shell",
  "title": "Custom Title",
  "link": "/",
  "language": "en-GB",
  "description": "Custom description",
  "font": "Poppins",
  "icon": "book",
  "footer": "Custom Footer 2024", <- BOOM
}

it doesn't render any error message, it just ignores it.

Sorry for the noise, situation normal.

lovasoa commented 1 month ago

I guess not seeing an error message is a problem in itself. Wasn't there anything in the logs either ?

lovasoa commented 1 month ago

@guspower : there was a bug where errors in the dynamic component were silently dropped. It's fixed now. So thank you for the report anyway !

guspower commented 1 month ago

Excellent, great outcome @lovasoa !