@atlaskit/link-datasource 6.13.4 → 6.13.5

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,14 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 6.13.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d096b1c221885`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d096b1c221885) -
8
+ Reduce datasource sync timestamp updates by scheduling the next minute, hour, or day boundary
9
+ behind a feature gate.
10
+ - Updated dependencies
11
+
3
12
  ## 6.13.4
4
13
 
5
14
  ### Patch Changes
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _reactIntl = require("react-intl");
13
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
13
14
  var _messages = require("./messages");
14
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
15
16
  var SECONDS_IN_MIN = 60;
@@ -36,6 +37,23 @@ var SyncInfo = exports.SyncInfo = function SyncInfo(_ref) {
36
37
  var totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
37
38
  var totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
38
39
  (0, _react.useEffect)(function () {
40
+ if ((0, _fg.fg)('platform_datasource_sync_info_boundary_updates')) {
41
+ var timeout;
42
+ var _update = function update() {
43
+ var elapsedMs = Date.now() - lastSyncTime.getTime();
44
+ setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
45
+ // At eight days the label becomes a fixed date, so no further updates are needed.
46
+ if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
47
+ return;
48
+ }
49
+ var unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
50
+ timeout = setTimeout(_update, unitMs - elapsedMs % unitMs);
51
+ };
52
+ _update();
53
+ return function () {
54
+ return clearTimeout(timeout);
55
+ };
56
+ }
39
57
  setSecondsSinceUpdate(calculateTimeDiff());
40
58
  var interval = setInterval(function () {
41
59
  return setSecondsSinceUpdate(calculateTimeDiff());
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React, { useCallback, useEffect, useState } from 'react';
3
3
  import { FormattedDate, FormattedMessage, FormattedRelativeTime } from 'react-intl';
4
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
4
5
  import { messages } from './messages';
5
6
  const SECONDS_IN_MIN = 60;
6
7
  const SECONDS_IN_HR = SECONDS_IN_MIN * 60;
@@ -22,6 +23,21 @@ export const SyncInfo = ({
22
23
  const totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
23
24
  const totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
24
25
  useEffect(() => {
26
+ if (fg('platform_datasource_sync_info_boundary_updates')) {
27
+ let timeout;
28
+ const update = () => {
29
+ const elapsedMs = Date.now() - lastSyncTime.getTime();
30
+ setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
31
+ // At eight days the label becomes a fixed date, so no further updates are needed.
32
+ if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
33
+ return;
34
+ }
35
+ const unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
36
+ timeout = setTimeout(update, unitMs - elapsedMs % unitMs);
37
+ };
38
+ update();
39
+ return () => clearTimeout(timeout);
40
+ }
25
41
  setSecondsSinceUpdate(calculateTimeDiff());
26
42
  const interval = setInterval(() => setSecondsSinceUpdate(calculateTimeDiff()), 1000);
27
43
  return () => clearInterval(interval);
@@ -2,6 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import React, { useCallback, useEffect, useState } from 'react';
4
4
  import { FormattedDate, FormattedMessage, FormattedRelativeTime } from 'react-intl';
5
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
5
6
  import { messages } from './messages';
6
7
  var SECONDS_IN_MIN = 60;
7
8
  var SECONDS_IN_HR = SECONDS_IN_MIN * 60;
@@ -27,6 +28,23 @@ export var SyncInfo = function SyncInfo(_ref) {
27
28
  var totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
28
29
  var totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
29
30
  useEffect(function () {
31
+ if (fg('platform_datasource_sync_info_boundary_updates')) {
32
+ var timeout;
33
+ var _update = function update() {
34
+ var elapsedMs = Date.now() - lastSyncTime.getTime();
35
+ setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
36
+ // At eight days the label becomes a fixed date, so no further updates are needed.
37
+ if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
38
+ return;
39
+ }
40
+ var unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
41
+ timeout = setTimeout(_update, unitMs - elapsedMs % unitMs);
42
+ };
43
+ _update();
44
+ return function () {
45
+ return clearTimeout(timeout);
46
+ };
47
+ }
30
48
  setSecondsSinceUpdate(calculateTimeDiff());
31
49
  var interval = setInterval(function () {
32
50
  return setSecondsSinceUpdate(calculateTimeDiff());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "6.13.4",
3
+ "version": "6.13.5",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,13 +39,13 @@
39
39
  "@atlaskit/afm-i18n-platform-linking-platform-link-datasource": "2.242.0",
40
40
  "@atlaskit/analytics-cross-product": "^2.2.0",
41
41
  "@atlaskit/analytics-next": "^12.5.0",
42
- "@atlaskit/atlassian-context": "^1.1.0",
42
+ "@atlaskit/atlassian-context": "^1.2.0",
43
43
  "@atlaskit/avatar": "^28.0.0",
44
44
  "@atlaskit/avatar-group": "^14.3.0",
45
45
  "@atlaskit/badge": "^21.2.0",
46
46
  "@atlaskit/button": "^25.3.0",
47
47
  "@atlaskit/css": "^1.1.0",
48
- "@atlaskit/datetime-picker": "^18.6.0",
48
+ "@atlaskit/datetime-picker": "^18.7.0",
49
49
  "@atlaskit/dropdown-menu": "^18.3.0",
50
50
  "@atlaskit/editor-prosemirror": "^8.0.0",
51
51
  "@atlaskit/empty-state": "^12.2.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/flag": "^18.5.0",
54
54
  "@atlaskit/form": "^17.2.0",
55
55
  "@atlaskit/heading": "^7.2.0",
56
- "@atlaskit/icon": "^37.6.0",
56
+ "@atlaskit/icon": "^37.7.0",
57
57
  "@atlaskit/image": "^5.2.0",
58
58
  "@atlaskit/inline-edit": "^16.4.0",
59
59
  "@atlaskit/intl-messages-provider": "^4.3.0",
@@ -83,7 +83,7 @@
83
83
  "@atlaskit/react-compiler-gating": "^0.2.0",
84
84
  "@atlaskit/react-select": "^4.9.0",
85
85
  "@atlaskit/select": "^22.11.0",
86
- "@atlaskit/smart-card": "^45.22.0",
86
+ "@atlaskit/smart-card": "^45.23.0",
87
87
  "@atlaskit/smart-user-picker": "^11.8.0",
88
88
  "@atlaskit/spinner": "^20.4.0",
89
89
  "@atlaskit/tag": "^15.8.0",
@@ -143,6 +143,9 @@
143
143
  "wait-for-expect": "^1.2.0"
144
144
  },
145
145
  "platform-feature-flags": {
146
+ "platform_datasource_sync_info_boundary_updates": {
147
+ "type": "boolean"
148
+ },
146
149
  "platform_navx_3298_message_wrapper": {
147
150
  "type": "boolean"
148
151
  },