Fragment post request

Hey. I have a part with a form that sends a post request to itself by using the component url. This worked great until I placed it inside a layout with some other stuff and created a fragment of it in content studio. Now I get this error: “Expected component to be a LayoutComponent: FragmentComponent” when I post the form. I am not sure how to interpret this error message, or what to do.

Any help would be appreciated. :smile:

1 Like

Hmm… Suspecting you may have discovered a limitation for parts in layouts that are converted to fragments… I assume the part is working fine when it is just placed in a layout, or made into a fragment itself?

A quickfix would be to move the “post handling” logic to a service/ instead!

Haven’t tried making it a fragment by itself, but it works in a layout. I thought about making a service, but I felt it was kinda overkill. I guess I’ll do it anyway then :slight_smile:

Great… This looks like a bug - but might be tricky to fix. So go for a service in the meantime.

I have reproduced the bug and registered an issue to fix it in 6.14.
I guess the workaround for now is to use a service, or not creating the fragment if that is an option.

In my opinion there is no need for a fragment, but my laziness thought otherwise. Is there a way to prevent the user from creating fragments?

Today no, all types of Components are “open” so to say. We are discussing some kind of control over this from the app itself.

In 6.14 (due in a few weeks), will let you “explode” fragments. Making them become separate components again.

1 Like