From this answer I got that:
You can only ajax-update a component which is always rendered (i.e. when it does not have a rendered attribute).
But I tried this code and ajax-update doesn't work for me, I need to refresh the browser to see the changed button. What am I doing wrong?
<p:outputPanel id="buttonArea">
<p:panel styleClass="button-area"
rendered="#{user != null and loginManager.profile.id != userPage.profile.id}">
<h:form>
<p:commandButton styleClass="button-flat" action="#{userPage.followUser}"
value="Follow" rendered="#{!userPage.followed}" update="buttonArea"/>
<p:commandButton styleClass="button-flat" action="#{userPage.unfollowUser}"
value="Unfollow" rendered="#{userPage.followed}" update="buttonArea"/>
</h:form>
</p:panel>
</p:outputPanel>
Edit:
I tried the solution from the possible duplicated question and it doesn't work either for me, I'm doing something wrong that it's not explained there, I tried with the ajax tag, the id in html is exactly 'buttonArea' but I even tried with and without colon when I reference the id, I tried with fragments...