getkirby / kirby

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

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

Closed distantnative closed 3 weeks ago

distantnative commented 1 month 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 1 month ago

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

afbora commented 1 month 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 1 month ago

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