@spoosh/plugin-debounce 0.2.2 → 0.2.3

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/index.js CHANGED
@@ -40,7 +40,7 @@ function debouncePlugin() {
40
40
  lifecycle: {
41
41
  onUnmount: (context) => {
42
42
  const { path, method } = context;
43
- const stableKey = `${path.join("/")}:${method}`;
43
+ const stableKey = `${path}:${method}`;
44
44
  const existingTimer = timers.get(stableKey);
45
45
  if (existingTimer) {
46
46
  clearTimeout(existingTimer);
@@ -56,9 +56,9 @@ function debouncePlugin() {
56
56
  if (debounceOption === void 0 || context.forceRefetch) {
57
57
  return next();
58
58
  }
59
- const { queryKey, requestOptions, path, method } = context;
60
- const stableKey = `${path.join("/")}:${method}`;
61
- const opts = requestOptions;
59
+ const { queryKey, request, path, method } = context;
60
+ const stableKey = `${path}:${method}`;
61
+ const opts = request;
62
62
  const currentRequest = {
63
63
  query: opts?.query,
64
64
  params: opts?.params
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ function debouncePlugin() {
14
14
  lifecycle: {
15
15
  onUnmount: (context) => {
16
16
  const { path, method } = context;
17
- const stableKey = `${path.join("/")}:${method}`;
17
+ const stableKey = `${path}:${method}`;
18
18
  const existingTimer = timers.get(stableKey);
19
19
  if (existingTimer) {
20
20
  clearTimeout(existingTimer);
@@ -30,9 +30,9 @@ function debouncePlugin() {
30
30
  if (debounceOption === void 0 || context.forceRefetch) {
31
31
  return next();
32
32
  }
33
- const { queryKey, requestOptions, path, method } = context;
34
- const stableKey = `${path.join("/")}:${method}`;
35
- const opts = requestOptions;
33
+ const { queryKey, request, path, method } = context;
34
+ const stableKey = `${path}:${method}`;
35
+ const opts = request;
36
36
  const currentRequest = {
37
37
  query: opts?.query,
38
38
  params: opts?.params
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spoosh/plugin-debounce",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Request debouncing plugin for Spoosh - waits for inactivity before fetching",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  }
34
34
  },
35
35
  "peerDependencies": {
36
- "@spoosh/core": ">=0.6.0"
36
+ "@spoosh/core": ">=0.11.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@spoosh/core": "0.10.0",
40
- "@spoosh/test-utils": "0.1.5"
39
+ "@spoosh/core": "0.11.0",
40
+ "@spoosh/test-utils": "0.1.6"
41
41
  },
42
42
  "scripts": {
43
43
  "dev": "tsup --watch",