question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Links/References all have the type `Link` which makes them not distinguishable

See original GitHub issue

I try to build a Contentful App using the @contentful/default-field-editors. I am using the FieldExtensionSDK to figure out the field type by looking at sdk.field which is an object of the class FieldAPI. Regarding to this source the field type can be one out of these types:

  • {type: “Symbol”}
  • {type: “Text”}
  • {type: “RichText”}
  • {type: “Integer”}
  • {type: “Number”}
  • {type: “Date”}
  • {type: “Boolean”}
  • {type: “Location”}
  • {type: “Object”}
  • {type: “Link”, linkType: “Asset”}
  • {type: “Link”, linkType: “Entry”}
  • {type: “Array”, items: {type: “Symbol”}}
  • {type: “Array”, items: {type: “Link”, linkType: “Entry”}}
  • {type: “Array”, items: {type: “Link”, linkType: “Asset”}}

This works correct for all field types except for Links and Arrays (the last 5 items from the list). For any link whether it is {type: "Link", linkType: "Asset"}, {type: "Array", items: {type: "Symbol"}} or one of the other 3 reference types the FieldAPI object I receive looks like:

{ id: ..., locale: ..., required: ..., type: "Link", items: undefined, ... }

Since the type field is always Link and items field is always undefined it is not possible to render the correct default field editor for this field. Though it seems to be possible to fetch the more detailed information from the API (mentioned above) and the default-field-editor supports these different types aswell, see here.

So my question is if this is a bug or maybe this is a feature which can be implemented? Maybe the information is somewhere hidden and I do not see it? I am happy to provide more information if needed.

Package versions

"@contentful/app-sdk": "^4.12.1",
"@contentful/default-field-editors": "^1.2.38",
"@contentful/f36-components": "^4.21.0",
"contentful-management": "^10.18.1",
"react": "^16.14.0",

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
fkoschicommented, Oct 28, 2022

@brokelyn I do have the exact same problem right now. Another interesting property, at least for my use case, would be the appearance applied to that field.

1reaction
brokelyncommented, Oct 25, 2022

No not really. I will try to make a small example of what I try to achive or where my problem is.

I have Content model A which has only one field called MediaFiles. This field is of type Media with Many files selected. As appearance I choose my own App.

When I now try to create an instance/object of this Content model A I expect my App to use the default-field-editor package and render a MultipleMediaEditor since the field MediaFiles is of type Media and can contain multiple files.

Unfortunately the default-field-editor wont render anything since it cant determine the type of the field MediaFiles. Looking at the sdk object I pass to default-field-editor I can see that the type I get from the FieldExtensionSDK (part of the App SDK) is looking like this:

{ id: ..., locale: ..., required: ..., type: "Link", items: undefined, ... }

but I would expect it to look like this (more information so I can render the correct component):

{ id: ..., locale: ..., required: ..., type: "Array", items: {type: "Link", linkType: "Asset"}, ... }

So basically what is described here, just passing the FieldExtensionSdk and the default-field-editor figures out which type of field it needs to render is not working for references.

Another reference is here under Getting the type of the field.

I hope now it is a bit more clear. Let me know if not!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding SC 2.4.4:Link Purpose (In Context) (Level A)
The intent of this Success Criterion is to help users understand the purpose of each link so they can decide whether they want...
Read more >
URLs - APA Style 6th Edition Blog
My reference list includes many URLs and I am wondering whether they should be live and how they should be formatted (e.g., with...
Read more >
DOIs and URLs - APA Style
This page addresses when to include digital object identifiers (DOIs) and uniform resource locators (URLs) in APA Style references.
Read more >
Links and Hypertext - Link Text and Appearance - WebAIM
These two requirements help ensure that all users can differentiate links from non-link text, even if they have low vision, color deficiency, or ......
Read more >
Should I use blue underlined hyperlinks in APA Style ...
You're pasting a DOI or URL into a reference list entry, and as soon as you hit the enter key, the text you've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found