0

I have a custom contentful app that overrides the EntryField. Then I also have a separate app that overrides a JSON field within that entry (that represents a button). When I add the entry app though, it seems to remove that JSON field app and shows just the raw json. Any ideas?

Here is the code for my entry

import { useEffect, useMemo } from "react"
import { EditorAppSDK, FieldAppSDK } from "@contentful/app-sdk"
import {
  Field as BaseField,
  FieldWrapper,
} from "@contentful/default-field-editors"
import { Heading, Subheading } from "@contentful/f36-components"
import { /* useCMA, */ useSDK } from "@contentful/react-apps-toolkit"

import styles from "./EntryEditor.module.css"

const Entry = () => {
  const sdk = useSDK<EditorAppSDK>()

  const getFieldAPI = (fieldId: string, sdk: EditorAppSDK) =>
    sdk.entry.fields[fieldId].getForLocale(sdk.locales.default)

  const getFieldExtensionSdk = (fieldId: string, sdk: EditorAppSDK) =>
    Object.assign({ field: getFieldAPI(fieldId, sdk) }, sdk)

  const fields = useMemo(
    () =>
      Object.values(sdk.entry.fields).map((field) => {
        return {
          field,
          sdk: getFieldExtensionSdk(field.id, sdk),
        }
      }),
    [sdk.entry.fields]
  )


  return (
    <div>
  
      

      {fields.map((f) => (
        <FieldWrapper
          key={f.field.id}
          sdk={f.sdk as FieldAppSDK}
          name={f.field.id}
        >
          <BaseField sdk={f.sdk as FieldAppSDK} isInitiallyDisabled={false} />
        </FieldWrapper>
      ))}
    </div>
  )
}

export default Entry

0 Answers0