getkirby / kirby

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

Link dialog: The request to `tree/parents` failed #6627

Closed distantnative closed 2 months ago

distantnative commented 3 months ago
Screenshot 2024-08-17 at 7 01 11 PM

The the sandbox…

  1. Go to writer field page
  2. Type in some text, use the link dialog to select the Home page, save
  3. Reload
  4. Select the linked word and open the link dialog
  5. See the error message
tobimori commented 2 months ago

Also happens with link field inside e.g. a structure.

afbora commented 2 months ago

Summary

When no parents found, response is array, array is empty and we have empty check: https://github.com/getkirby/kirby/blob/4.4.0-rc.1/src/Panel/Json.php#L78-L80

Possible solutions

return [
  'data' => $parents
];
distantnative commented 2 months ago

@afbora Makes sense, thanks for debugging. I think the 2nd solution sounds like the best way with our API.