druxt-menu 0.19.3 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -220,6 +220,15 @@ export default {
220
220
  },
221
221
  },
222
222
 
223
+ mounted() {
224
+ // If logged in and statically generated, re-fetch the menu.
225
+ if (this?.$auth?.loggedIn && this?.$store?.app?.context?.isStatic) {
226
+ this.$store.commit('druxtMenu/flushEntities', { prefix: this.lang })
227
+ const settings = this.$options.druxt.settings(this, this.component.settings)
228
+ this.$options.druxt.fetchData.call(this, settings)
229
+ }
230
+ },
231
+
223
232
  methods: {
224
233
  /**
225
234
  * Recursively gets required menu items from the Vuex store.
@@ -167,6 +167,12 @@ const DruxtMenuStore = ({ store }) => {
167
167
  const entity = entities[index];
168
168
  Vue.set(state.entities[prefix], entity.id, entity);
169
169
  }
170
+ },
171
+ flushEntities(state, { prefix }) {
172
+ if (!prefix || typeof state.entities !== "object")
173
+ Vue.set(state, "entities", {});
174
+ if (prefix)
175
+ Vue.set(state.entities, prefix, {});
170
176
  }
171
177
  },
172
178
  actions: {
@@ -175,6 +175,12 @@ const DruxtMenuStore = ({ store }) => {
175
175
  const entity = entities[index];
176
176
  Vue__default["default"].set(state.entities[prefix], entity.id, entity);
177
177
  }
178
+ },
179
+ flushEntities(state, { prefix }) {
180
+ if (!prefix || typeof state.entities !== "object")
181
+ Vue__default["default"].set(state, "entities", {});
182
+ if (prefix)
183
+ Vue__default["default"].set(state.entities, prefix, {});
178
184
  }
179
185
  },
180
186
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt-menu",
3
- "version": "0.19.3",
3
+ "version": "0.21.0",
4
4
  "description": "Drupal Menu and Menu item Druxt components, with support for the JSON:API Menu Items module.",
5
5
  "keywords": [
6
6
  "cms",