In my translations plugin I added a revert button to reset the entire translation of a page back to the content of the default language.
Reverting the content in the corresponding .txt file works, but the panel still shows the old content, because the panel page is not reloaded.
I found this code snippet in Kirby core …
this.$store.dispatch("form/revert", this.id);
… which is used by the default revert button after changes have been made by an author. But I’m pretty sure that this.$store is the wrong place for me, because my changes have been made in the textfile and not in the panel (without saving).
I do not think that this.$store is the wrong place for you. I didn’t use it inside a Kirby plugin yet, but this is generally the way to got if you want to manipulate the global state in a vuex (vue + global state handling) context. If it works, it looks fine to me.
You might have a look at the PageView.vue component, whenever the language is changed the page calls a fetch() method. That’s probably the one you want to trigger. But I’m not sure if there’s a non-hacky way (that’d be, for example, mimicking a language change) to reach it.
I don’t think there is a good way at the moment. We should introduce a new event that can be emitted via this.$event.$emit() and then triggers the page to be reloaded. Could you please open an issue? Maybe we can get it into 3.1 still.