From 5c7941eb9b09ad9061dad8097003f04c56402c23 Mon Sep 17 00:00:00 2001 From: Ricardo Devis Agullo Date: Fri, 5 Sep 2025 09:53:47 +0200 Subject: [PATCH 1/3] upv --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 746ae0a..f31c85e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oc-client-browser", - "version": "2.1.5", + "version": "2.1.6", "description": "OC browser client", "main": "index.js", "types": "index.d.ts", From 14f3f245dee753eaf4abdaff7ce047265cff0c82 Mon Sep 17 00:00:00 2001 From: Ricardo Devis Agullo Date: Fri, 5 Sep 2025 18:04:19 +0200 Subject: [PATCH 2/3] add option for lazy ocs --- src/oc-client.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/oc-client.js b/src/oc-client.js index a47bd73..f70a830 100644 --- a/src/oc-client.js +++ b/src/oc-client.js @@ -723,7 +723,20 @@ export function createOc(oc) { } if (this.#manageLifecycle) { - oc.renderNestedComponent(this, () => {}); + if (this.getAttribute("lazy") === "true") { + const observer = new IntersectionObserver((entries) => { + for (const entry of entries) { + if (entry.isIntersecting) { + observer.disconnect(); + oc.renderNestedComponent(this, () => {}); + break; + } + } + }); + observer.observe(this); + } else { + oc.renderNestedComponent(this, () => {}); + } } } From c48139bf3cdb3d7225949bf80e3a2d2fd820c5ac Mon Sep 17 00:00:00 2001 From: Ricardo Devis Agullo Date: Fri, 5 Sep 2025 20:12:47 +0200 Subject: [PATCH 3/3] change attr name --- src/oc-client.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oc-client.js b/src/oc-client.js index f70a830..42e5474 100644 --- a/src/oc-client.js +++ b/src/oc-client.js @@ -723,7 +723,7 @@ export function createOc(oc) { } if (this.#manageLifecycle) { - if (this.getAttribute("lazy") === "true") { + if (this.getAttribute("loading") === "lazy") { const observer = new IntersectionObserver((entries) => { for (const entry of entries) { if (entry.isIntersecting) {