XF 2.1 Stale ajax modal content

sccrgy789

Member
Hi there-

We're in the process of moving from XF1 to XF2 and I'm currently rewriting all of our addons. I've figured a lot out on my own using documentation and other threads in this community, but one thing I can't seem to get 100% right is handling the content in ajax modals/popups. For example...

Let's say a user clicks a link in the thread options menu to invite another user to edit their thread. They get this popup where they can remove users or invite others (this behaves as expected):

before.webp

If I check "MattTest" and click save to remove them, the modal content is updated to this (which is correct):

after.webp

Now, if I close the modal and launch it again using the same link in the thread options menu, I get this (which is not correct, it reverts to the original modal content somehow):

before.webp

Refreshing the entire page solves the issue because XF repopulates the modal on first launch, but I'd like to avoid refreshing the page. Is there a way to force XF to update the modal content with every launch or a way I can get the updated content (the middle image above) to persist between modal launches?

Hope this makes sense. Thanks for any help you can provide :)
 
Add data-cache="false" to the overlay click handler, e.g.:
Code:
data-xf-click="overlay" data-cache="false"
 
Top Bottom