Skip to content

Expose what a link resolved to, and the safe reference read behind it #769

Description

@romain-pm

Part of #749. The link tier knows things it refuses to tell the caller.

  • Return the resolved target on LinkProps. jahia.com needs it for a label fallback and could not get it, so it hand-wrote the reference read.
  • Export the safe reference reader. resolveContentLink has a private readReference — a try/catch around getProperty().getValue().getNode() — and it is the thing that stops a dangling reference from throwing. It is exactly what every module needs and it is not exported. jahia.com re-wrote it in 8 lines in NavBar.tsx.
  • Consider making it a first-class library export next to getNodeProps: reading a reference safely is not a link concern, it is a JCR concern. Any view touching a weakreference has the same problem, because an unresolvable reference reaches JavaScript as a plain falsy value with no way to tell "unset" from "unpublished" from "forbidden".

Metadata

Metadata

Assignees

No one assigned

    Labels

    featA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions