I have an App Route A for a page and is loading all the fields including a multilist that links to Item App Route B that can have in the multilist a link to Item A, creating a infinite loop. Is there a way to set the depth to only one level?
AppRoute A:
fields:
multifield:
AppRoute B
AppRoute B:
fields:
multifield:
AppRoute A
There are two options, you can create a patch for the configuration file to update the layoutService serializationMaxDepth, but this will affect all the Items:
Or you can craete your custom field serialization resolver.
This class will add the information to the field:
This class will be the field resolver:
And this is the configuration patch to set the resolver class to your field. Make sure to place your config(patch:before) before the field default serialization configuration, in this case the multililist is
GetMultilistFieldSerializeryou can check this inhttps://<your-sitecore-domain>/sitecore/admin/showconfig.aspx: