@atlaskit/react-ufo 4.15.11 → 4.15.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 4.15.12
4
+
5
+ ### Patch Changes
6
+
7
+ - [`19af60b5294cd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19af60b5294cd) -
8
+ Reduces eagerness of ssr placeholder checking
9
+
3
10
  ## 4.15.11
4
11
 
5
12
  ### Patch Changes
@@ -245,12 +245,13 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
245
245
  }, {
246
246
  key: "findNearestPlaceholderOrContainer",
247
247
  value: function findNearestPlaceholderOrContainer(element) {
248
+ var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ANCESTOR_LOOKUP_LIMIT;
248
249
  var ancestor = element;
249
250
  if (this.isPlaceholderIgnored(element) && element.parentElement) {
250
251
  ancestor = element.parentElement;
251
252
  }
252
253
  var i = 0;
253
- while (ancestor && i < ANCESTOR_LOOKUP_LIMIT) {
254
+ while (ancestor && i < limit) {
254
255
  if (this.isPlaceholder(ancestor) || this.isPlaceholderReplacement(ancestor)) {
255
256
  return ancestor;
256
257
  }
@@ -325,7 +326,8 @@ var SSRPlaceholderHandlers = exports.SSRPlaceholderHandlers = /*#__PURE__*/funct
325
326
  }, {
326
327
  key: "validateReactComponentMatchToPlaceholderV4",
327
328
  value: function validateReactComponentMatchToPlaceholderV4(el) {
328
- el = (0, _platformFeatureFlags.fg)('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el) : this.findNearestPlaceholderContainerIfIgnored(el);
329
+ el = (0, _platformFeatureFlags.fg)('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el, 2) // We are using 2 due to over-eagerness of the default, only check itself and 1 ancestor
330
+ : this.findNearestPlaceholderContainerIfIgnored(el);
329
331
  var id = this.getPlaceholderReplacementId(el);
330
332
  return this.staticPlaceholders.has(id);
331
333
  }
@@ -209,13 +209,13 @@ export class SSRPlaceholderHandlers {
209
209
  }
210
210
  return element;
211
211
  }
212
- findNearestPlaceholderOrContainer(element) {
212
+ findNearestPlaceholderOrContainer(element, limit = ANCESTOR_LOOKUP_LIMIT) {
213
213
  let ancestor = element;
214
214
  if (this.isPlaceholderIgnored(element) && element.parentElement) {
215
215
  ancestor = element.parentElement;
216
216
  }
217
217
  let i = 0;
218
- while (ancestor && i < ANCESTOR_LOOKUP_LIMIT) {
218
+ while (ancestor && i < limit) {
219
219
  if (this.isPlaceholder(ancestor) || this.isPlaceholderReplacement(ancestor)) {
220
220
  return ancestor;
221
221
  }
@@ -277,7 +277,8 @@ export class SSRPlaceholderHandlers {
277
277
  });
278
278
  }
279
279
  validateReactComponentMatchToPlaceholderV4(el) {
280
- el = fg('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el) : this.findNearestPlaceholderContainerIfIgnored(el);
280
+ el = fg('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el, 2) // We are using 2 due to over-eagerness of the default, only check itself and 1 ancestor
281
+ : this.findNearestPlaceholderContainerIfIgnored(el);
281
282
  const id = this.getPlaceholderReplacementId(el);
282
283
  return this.staticPlaceholders.has(id);
283
284
  }
@@ -238,12 +238,13 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
238
238
  }, {
239
239
  key: "findNearestPlaceholderOrContainer",
240
240
  value: function findNearestPlaceholderOrContainer(element) {
241
+ var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ANCESTOR_LOOKUP_LIMIT;
241
242
  var ancestor = element;
242
243
  if (this.isPlaceholderIgnored(element) && element.parentElement) {
243
244
  ancestor = element.parentElement;
244
245
  }
245
246
  var i = 0;
246
- while (ancestor && i < ANCESTOR_LOOKUP_LIMIT) {
247
+ while (ancestor && i < limit) {
247
248
  if (this.isPlaceholder(ancestor) || this.isPlaceholderReplacement(ancestor)) {
248
249
  return ancestor;
249
250
  }
@@ -318,7 +319,8 @@ export var SSRPlaceholderHandlers = /*#__PURE__*/function () {
318
319
  }, {
319
320
  key: "validateReactComponentMatchToPlaceholderV4",
320
321
  value: function validateReactComponentMatchToPlaceholderV4(el) {
321
- el = fg('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el) : this.findNearestPlaceholderContainerIfIgnored(el);
322
+ el = fg('platform_ufo_v4_fix_nested_ssr_placeholder') ? this.findNearestPlaceholderOrContainer(el, 2) // We are using 2 due to over-eagerness of the default, only check itself and 1 ancestor
323
+ : this.findNearestPlaceholderContainerIfIgnored(el);
322
324
  var id = this.getPlaceholderReplacementId(el);
323
325
  return this.staticPlaceholders.has(id);
324
326
  }
@@ -31,7 +31,7 @@ export declare class SSRPlaceholderHandlers {
31
31
  isPlaceholderV4(element: HTMLElement): boolean;
32
32
  isPlaceholderReplacementV4(element: HTMLElement): boolean;
33
33
  findNearestPlaceholderContainerIfIgnored(element: HTMLElement): HTMLElement;
34
- findNearestPlaceholderOrContainer(element: HTMLElement): HTMLElement;
34
+ findNearestPlaceholderOrContainer(element: HTMLElement, limit?: number): HTMLElement;
35
35
  checkIfExistedAndSizeMatching(el: HTMLElement): Promise<boolean>;
36
36
  checkIfExistedAndSizeMatchingV3(el: HTMLElement): boolean;
37
37
  getSize(el: HTMLElement): Promise<Rect>;
@@ -31,7 +31,7 @@ export declare class SSRPlaceholderHandlers {
31
31
  isPlaceholderV4(element: HTMLElement): boolean;
32
32
  isPlaceholderReplacementV4(element: HTMLElement): boolean;
33
33
  findNearestPlaceholderContainerIfIgnored(element: HTMLElement): HTMLElement;
34
- findNearestPlaceholderOrContainer(element: HTMLElement): HTMLElement;
34
+ findNearestPlaceholderOrContainer(element: HTMLElement, limit?: number): HTMLElement;
35
35
  checkIfExistedAndSizeMatching(el: HTMLElement): Promise<boolean>;
36
36
  checkIfExistedAndSizeMatchingV3(el: HTMLElement): boolean;
37
37
  getSize(el: HTMLElement): Promise<Rect>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "4.15.11",
3
+ "version": "4.15.12",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",