getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.31k stars 168 forks source link

Link field should display proper errors #6731

Open linusrogge opened 2 weeks ago

linusrogge commented 2 weeks ago

Description

Creating a type: link field with adjusted options does not return an error when options are invalid. I know this is on the dev to get right, but you might not want to look up the docs every time and find out through trial and error—currently, the whole field is completeley hidden when at least one option is wrong.

The field is shown in the structure preview but not in the opened drawer.

Expected behavior

The field should render an error, displaying the wrong options provided (in my case used - pages instead of - page).

Screenshots

Screenshot 2024-10-09 at 12 55 15 PM Screenshot 2024-10-09 at 12 55 23 PM

To reproduce

  1. Create a blueprint with a type: link field and set the options to something like options: - pages
  2. Look at the Panel and see… nothing
  3. Correct the options and the field should appear

Your setup

Kirby Version

4.4.1

Console output

Screenshot 2024-10-09 at 12 59 51 PM

Your system (please complete the following information)

linusrogge commented 2 weeks ago

Also a comment on the link field, although this does not quite belong here—it would be very helpful to customise the specific options further. Like with the page option, to also set a query, filter or exclude certain pages. Just for convenience and better UX for clients.

afbora commented 1 week ago

There isn't a pages option . It should be page:

link:
  type: link
  options: 
    - page

About query feature, check out: https://feedback.getkirby.com/574

linusrogge commented 1 week ago

@afbora thanks for your reply, but please read my actual issues again. I know there isn’t a pages option and that is exactly my point: kirby doesn’t tell me anything about that—it just completely hides the field from the blueprint.

Thanks for the link

afbora commented 6 days ago

Sorry @linusrogge I misread your issue. Let me try to fix it.

@distantnative Do you think we should throw exception about invalid option or ignore invalid options and use fallback options?

distantnative commented 6 days ago

@afbora i haven't been able to look into it but I am wondering why no error is shown (even if cryptic) but the field just disappears.

afbora commented 6 days ago

I've looked but didn't understand either why swallow the error? I can fix this issue via throwing an error or ignoring the error from backend side.