Hide / Show Components in Public App

I'm trying to hide component within an app which is public viewable with this code:

{{!current_user.groups.some(group => group.id === 2478655)
}}

image

image

Javascript code seems to work, but the component is actually viewable when accessing it with an icognito tab.

Any idea?

it seems that in public view the current_user object ist not available

Any idea how I can hide/disable componets inside a public view?

Solved!

As the current_user object seems to not be available in public.

Instead of trying to hide componets, I have set the "show body" option inside the appearance section for containers to achieve visability only for users.

image

OR LIKE THIS:

You can also use

!current_user || !current_user.groups || !current_user.groups.some(group => group.id === 2478655)

within the "hidden" field

2 Likes