druxt 0.25.0-dev.20260921034536 → 0.25.0-dev.20260922103051

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.
package/dist/druxt.esm.js CHANGED
@@ -263,7 +263,7 @@ class DruxtClient {
263
263
  }
264
264
 
265
265
  var name = "druxt";
266
- var version = "0.25.0-dev.20260921034536";
266
+ var version = "0.25.0-dev.20260922103051";
267
267
  var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
268
268
  var keywords = [
269
269
  "cms",
@@ -322,7 +322,7 @@ var dependencies = {
322
322
  };
323
323
  var devDependencies = {
324
324
  "@storybook/addon-docs": "^6.5.16",
325
- "druxt-test-utils": "1.0.0-dev.20260921034536"
325
+ "druxt-test-utils": "1.0.0-dev.20260922103051"
326
326
  };
327
327
  var peerDependencies = {
328
328
  axios: "0.28.0",
@@ -501,6 +501,16 @@ const DruxtStore = ({ store }) => {
501
501
  throw new TypeError("Vuex store not found.");
502
502
  }
503
503
  const namespace = "druxt";
504
+ const inFlight = new Map();
505
+ const share = (key, request) => {
506
+ if (!inFlight.has(key)) {
507
+ const clear = () => inFlight.delete(key);
508
+ const promise = request();
509
+ inFlight.set(key, promise);
510
+ promise.then(clear, clear);
511
+ }
512
+ return inFlight.get(key);
513
+ };
504
514
  const module = {
505
515
  namespaced: true,
506
516
  state: () => ({
@@ -588,9 +598,12 @@ const DruxtStore = ({ store }) => {
588
598
  };
589
599
  }
590
600
  }
591
- const collection = await this.$druxt.getCollection(type, query, prefix);
592
- commit("addCollection", { collection: { ...collection }, type, hash, prefix });
593
- return collection;
601
+ const key = JSON.stringify(["collection", prefix, type, hash, queryObject]);
602
+ return share(key, async () => {
603
+ const collection = await this.$druxt.getCollection(type, query, prefix);
604
+ commit("addCollection", { collection: { ...collection }, type, hash, prefix });
605
+ return collection;
606
+ });
594
607
  },
595
608
  async getResource({ commit, dispatch, state }, { type, id, query, prefix, bypassCache = false }) {
596
609
  const storedResource = ((state.resources[type] || {})[id] || {})[prefix] ? { ...state.resources[type][id][prefix] } : null;
@@ -639,8 +652,12 @@ const DruxtStore = ({ store }) => {
639
652
  let resource;
640
653
  if (bypassCache || !storedResource || fields) {
641
654
  try {
642
- resource = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
643
- commit("addResource", { prefix, resource: { ...resource } });
655
+ const key = JSON.stringify(["resource", prefix, type, id, queryObject]);
656
+ resource = await share(key, async () => {
657
+ const response = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
658
+ commit("addResource", { prefix, resource: { ...response } });
659
+ return response;
660
+ });
644
661
  } catch (e) {
645
662
  }
646
663
  }
package/dist/druxt.ssr.js CHANGED
@@ -276,7 +276,7 @@ class DruxtClient {
276
276
  }
277
277
 
278
278
  var name = "druxt";
279
- var version = "0.25.0-dev.20260921034536";
279
+ var version = "0.25.0-dev.20260922103051";
280
280
  var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
281
281
  var keywords = [
282
282
  "cms",
@@ -335,7 +335,7 @@ var dependencies = {
335
335
  };
336
336
  var devDependencies = {
337
337
  "@storybook/addon-docs": "^6.5.16",
338
- "druxt-test-utils": "1.0.0-dev.20260921034536"
338
+ "druxt-test-utils": "1.0.0-dev.20260922103051"
339
339
  };
340
340
  var peerDependencies = {
341
341
  axios: "0.28.0",
@@ -514,6 +514,16 @@ const DruxtStore = ({ store }) => {
514
514
  throw new TypeError("Vuex store not found.");
515
515
  }
516
516
  const namespace = "druxt";
517
+ const inFlight = new Map();
518
+ const share = (key, request) => {
519
+ if (!inFlight.has(key)) {
520
+ const clear = () => inFlight.delete(key);
521
+ const promise = request();
522
+ inFlight.set(key, promise);
523
+ promise.then(clear, clear);
524
+ }
525
+ return inFlight.get(key);
526
+ };
517
527
  const module = {
518
528
  namespaced: true,
519
529
  state: () => ({
@@ -601,9 +611,12 @@ const DruxtStore = ({ store }) => {
601
611
  };
602
612
  }
603
613
  }
604
- const collection = await this.$druxt.getCollection(type, query, prefix);
605
- commit("addCollection", { collection: { ...collection }, type, hash, prefix });
606
- return collection;
614
+ const key = JSON.stringify(["collection", prefix, type, hash, queryObject]);
615
+ return share(key, async () => {
616
+ const collection = await this.$druxt.getCollection(type, query, prefix);
617
+ commit("addCollection", { collection: { ...collection }, type, hash, prefix });
618
+ return collection;
619
+ });
607
620
  },
608
621
  async getResource({ commit, dispatch, state }, { type, id, query, prefix, bypassCache = false }) {
609
622
  const storedResource = ((state.resources[type] || {})[id] || {})[prefix] ? { ...state.resources[type][id][prefix] } : null;
@@ -652,8 +665,12 @@ const DruxtStore = ({ store }) => {
652
665
  let resource;
653
666
  if (bypassCache || !storedResource || fields) {
654
667
  try {
655
- resource = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
656
- commit("addResource", { prefix, resource: { ...resource } });
668
+ const key = JSON.stringify(["resource", prefix, type, id, queryObject]);
669
+ resource = await share(key, async () => {
670
+ const response = await this.$druxt.getResource(type, id, getDrupalJsonApiParams(queryObject), prefix);
671
+ commit("addResource", { prefix, resource: { ...response } });
672
+ return response;
673
+ });
657
674
  } catch (e) {
658
675
  }
659
676
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "druxt",
3
- "version": "0.25.0-dev.20260921034536",
3
+ "version": "0.25.0-dev.20260922103051",
4
4
  "description": "The Fully Decoupled Drupal Framework for Nuxt.js.",
5
5
  "keywords": [
6
6
  "cms",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@storybook/addon-docs": "^6.5.16",
62
- "druxt-test-utils": "1.0.0-dev.20260921034536"
62
+ "druxt-test-utils": "1.0.0-dev.20260922103051"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "axios": "0.28.0",