@luvio/lwc-luvio 0.157.1-dev2 → 0.157.1-dev4

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/lwcluvio.js CHANGED
@@ -358,7 +358,58 @@ function createWireAdapterConstructor(adapter, name, luvio) {
358
358
  return constructor;
359
359
  }
360
360
 
361
+ /**
362
+ * Simple deep equality comparison for configuration objects.
363
+ * Handles primitives, arrays, and plain objects.
364
+ */
365
+ function deepEquals(a, b) {
366
+ if (a === b) {
367
+ return true;
368
+ }
369
+ if (a === null || a === undefined || b === null || b === undefined) {
370
+ return a === b;
371
+ }
372
+ if (typeof a !== typeof b) {
373
+ return false;
374
+ }
375
+ if (typeof a !== 'object') {
376
+ return false;
377
+ }
378
+ if (Array.isArray(a) !== Array.isArray(b)) {
379
+ return false;
380
+ }
381
+ if (Array.isArray(a) && Array.isArray(b)) {
382
+ if (a.length !== b.length) {
383
+ return false;
384
+ }
385
+ for (let i = 0; i < a.length; i++) {
386
+ if (!deepEquals(a[i], b[i])) {
387
+ return false;
388
+ }
389
+ }
390
+ return true;
391
+ }
392
+ // Handle plain objects
393
+ const aKeys = Object.keys(a);
394
+ const bKeys = Object.keys(b);
395
+ if (aKeys.length !== bKeys.length) {
396
+ return false;
397
+ }
398
+ for (const key of aKeys) {
399
+ if (!bKeys.includes(key)) {
400
+ return false;
401
+ }
402
+ if (!deepEquals(a[key], b[key])) {
403
+ return false;
404
+ }
405
+ }
406
+ return true;
407
+ }
361
408
  class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
409
+ constructor(adapter, name, luvio, callback, sourceContext, paginationConfigParamNames) {
410
+ super(adapter, name, luvio, callback, sourceContext);
411
+ this.paginationConfigParamNames = paginationConfigParamNames;
412
+ }
362
413
  /**
363
414
  * Called when the component associated with the wire adapter is connected.
364
415
  */
@@ -381,6 +432,19 @@ class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
381
432
  */
382
433
  update(config, context) {
383
434
  if (this.connectTimestamp) {
435
+ // compare the incoming config with the current config.
436
+ // if any non-pagination config params have changed, we need to reset the connectTimestamp
437
+ const currentConfig = this.config;
438
+ // Check if any non-pagination parameters have changed
439
+ const hasNonPaginationParamChanged = Object.keys(config).some((paramName) => {
440
+ var _a;
441
+ // If this is not a pagination param and its value has changed
442
+ return (!((_a = this.paginationConfigParamNames) === null || _a === void 0 ? void 0 : _a.includes(paramName)) &&
443
+ !deepEquals(config[paramName], currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig[paramName]));
444
+ });
445
+ if (hasNonPaginationParamChanged) {
446
+ this.connectTimestamp = Date.now();
447
+ }
384
448
  const adapterRequestContext = this.generateAdapterRequestContext(context);
385
449
  super.unsubscribe();
386
450
  this.config = sanitize(config);
@@ -416,9 +480,9 @@ class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
416
480
  }
417
481
  }
418
482
  }
419
- function createInfiniteScrollingWireAdapterConstructor(adapter, name, luvio) {
483
+ function createInfiniteScrollingWireAdapterConstructor(adapter, name, luvio, paginationConfigParamNames) {
420
484
  const constructor = function (callback, sourceContext) {
421
- const delegate = new LWCInfinteScrollingLuvioWireAdapter(adapter, name, luvio, callback, sourceContext);
485
+ const delegate = new LWCInfinteScrollingLuvioWireAdapter(adapter, name, luvio, callback, sourceContext, paginationConfigParamNames);
422
486
  this.connect = () => delegate.connect();
423
487
  this.disconnect = () => delegate.disconnect();
424
488
  this.update = (config, context) => delegate.update(config, context);
@@ -1,8 +1,11 @@
1
1
  import type { Adapter, AdapterRequestContext, Luvio, Snapshot } from '@luvio/engine';
2
- import type { WireAdapterConstructor, WireConfigValue, WireContextValue } from 'lwc';
2
+ import type { WireAdapterConstructor, WireConfigValue, WireContextValue, WireDataCallback } from 'lwc';
3
+ import type { SourceContext } from './LWCLuvioWireAdapter';
3
4
  import { LWCLuvioWireAdapter } from './LWCLuvioWireAdapter';
4
5
  export declare class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAdapter {
6
+ constructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio, callback: WireDataCallback, sourceContext?: SourceContext, paginationConfigParamNames?: string[]);
5
7
  private connectTimestamp?;
8
+ private paginationConfigParamNames?;
6
9
  /**
7
10
  * Called when the component associated with the wire adapter is connected.
8
11
  */
@@ -21,4 +24,4 @@ export declare class LWCInfinteScrollingLuvioWireAdapter extends LWCLuvioWireAda
21
24
  protected generateAdapterRequestContext(context?: WireContextValue): AdapterRequestContext;
22
25
  protected subscribe(snapshot: Snapshot<unknown>): void;
23
26
  }
24
- export declare function createInfiniteScrollingWireAdapterConstructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio): WireAdapterConstructor;
27
+ export declare function createInfiniteScrollingWireAdapterConstructor(adapter: Adapter<unknown, unknown>, name: string, luvio: Luvio, paginationConfigParamNames?: string[]): WireAdapterConstructor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luvio/lwc-luvio",
3
- "version": "0.157.1-dev2",
3
+ "version": "0.157.1-dev4",
4
4
  "description": "Lightning Web Component bindings for Luvio",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,11 +29,11 @@
29
29
  "watch": "yarn build --watch"
30
30
  },
31
31
  "dependencies": {
32
- "@luvio/engine": "0.157.1-dev2"
32
+ "@luvio/engine": "0.157.1-dev4"
33
33
  },
34
34
  "devDependencies": {
35
- "@luvio/adapter-test-library": "0.157.1-dev2",
36
- "@luvio/cli": "0.157.1-dev2",
35
+ "@luvio/adapter-test-library": "0.157.1-dev4",
36
+ "@luvio/cli": "0.157.1-dev4",
37
37
  "@lwc/jest-preset": "18.1.0",
38
38
  "jest-environment-jsdom": "^29.5.0"
39
39
  },
@@ -44,9 +44,9 @@
44
44
  {
45
45
  "path": "./dist/lwcluvio.js",
46
46
  "maxSize": {
47
- "none": "21 kB",
48
- "min": "7.5 kB",
49
- "compressed": "4.1 kB"
47
+ "none": "23 kB",
48
+ "min": "8.5 kB",
49
+ "compressed": "4.6 kB"
50
50
  }
51
51
  }
52
52
  ],