@gem-sdk/core 2.1.17 → 2.1.18

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.
@@ -294,6 +294,8 @@ const RenderChildren = (props)=>{
294
294
  const WrapRenderChildren = ({ uid, customProps }, codes)=>{
295
295
  let liquid = '';
296
296
  if (codes?.length) {
297
+ // Limit each child item of an element (e.g., marquee, ...) to ensure the total element size does not exceed 256KB.
298
+ const itemMaxSize = 200 / codes.length;
297
299
  for(let i = 0; i < codes.length; i++){
298
300
  const code = codes[i];
299
301
  if (code) {
@@ -301,7 +303,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
301
303
  // Fix limit 256kb
302
304
  const textEncoder = new TextEncoder();
303
305
  const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
304
- if (Math.ceil(size / 1024) >= 180) {
306
+ if (Math.ceil(size / 1024) >= itemMaxSize) {
305
307
  const fileName = `gp-section-snippet-${uid + i}`;
306
308
  customProps.extraFiles[fileName] = code;
307
309
  liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
@@ -290,6 +290,8 @@ const RenderChildren = (props)=>{
290
290
  const WrapRenderChildren = ({ uid, customProps }, codes)=>{
291
291
  let liquid = '';
292
292
  if (codes?.length) {
293
+ // Limit each child item of an element (e.g., marquee, ...) to ensure the total element size does not exceed 256KB.
294
+ const itemMaxSize = 200 / codes.length;
293
295
  for(let i = 0; i < codes.length; i++){
294
296
  const code = codes[i];
295
297
  if (code) {
@@ -297,7 +299,7 @@ const WrapRenderChildren = ({ uid, customProps }, codes)=>{
297
299
  // Fix limit 256kb
298
300
  const textEncoder = new TextEncoder();
299
301
  const size = newLiquid ? textEncoder.encode(newLiquid).length : 0;
300
- if (Math.ceil(size / 1024) >= 180) {
302
+ if (Math.ceil(size / 1024) >= itemMaxSize) {
301
303
  const fileName = `gp-section-snippet-${uid + i}`;
302
304
  customProps.extraFiles[fileName] = code;
303
305
  liquid += `{% render '${fileName}', product: product, variant: variant, product_form_id: product_form_id, productSelectedVariant: productSelectedVariant, form: form %}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "2.1.17",
3
+ "version": "2.1.18",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",