Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No Link" (nulled out link) still produces an object in GQL response #243

Open
tremby opened this issue Oct 15, 2022 · 2 comments
Open

"No Link" (nulled out link) still produces an object in GQL response #243

tremby opened this issue Oct 15, 2022 · 2 comments

Comments

@tremby
Copy link

tremby commented Oct 15, 2022

I'm grabbing data from GraphQL and I still get an object (with ariaLabel: null, element: null, target: "", text: "[my default link text]", url: null) for a field which I've marked as "no link". I would expect not an object but null instead.

Related to #147

@only1pulcinellacasarina

This is a problem. I want to display a link only if there is a link. But a check like this doesn't work:
{% if block.myLink %}<a href="{{ block.myLink }}">{% endif %}

Whilst {{ block.myLink }} doesn't display anything, it still think it is something.

In the page entry the link has a dropdown menu with the default (No link) selected.

@garycrane
Copy link

garycrane commented Oct 23, 2022

I'm experiencing the same issue as @only1pulcinellacasarina. I think this might be related to another bug, in which the default link type isn't being honoured.

Update
@only1pulcinellacasarina Looking at the docs, block.myLink will return an empty string if it's unset. Either use block.myLink != '' or block.myLink.getLink() within your conditional. I think this is a change from previous versions, as the block.myLink used to work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants