@atlaskit/editor-synced-block-renderer 5.5.0 → 5.6.0

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/editor-synced-block-renderer
2
2
 
3
+ ## 5.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`f998026c7a01a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f998026c7a01a) -
8
+ EDITOR-2849 fix editor SSR
9
+
3
10
  ## 5.5.0
4
11
 
5
12
  ### Minor Changes
@@ -64,6 +64,7 @@ var SyncedBlockErrorComponent = exports.SyncedBlockErrorComponent = function Syn
64
64
  /*#__PURE__*/
65
65
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
66
66
  _react.default.createElement("div", {
67
+ "data-testid": "sync-block-error",
67
68
  className: _syncBlock.SyncBlockSharedCssClassName.error
68
69
  }, getErrorContent)
69
70
  );
@@ -47,11 +47,14 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
47
47
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], function (_ref2) {
48
48
  var connectivityState = _ref2.connectivityState;
49
49
  return {
50
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
50
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
51
51
  };
52
52
  }),
53
- isInternetOffline = _useSharedPluginState.isInternetOffline;
54
- if (isInternetOffline) {
53
+ isCollabOffline = _useSharedPluginState.isCollabOffline;
54
+
55
+ // Show offline error only when collaboration is offline and not in SSR mode
56
+ // In SSR, we should always attempt to render content
57
+ if (isCollabOffline && !(0, _coreUtils.isSSR)()) {
55
58
  return /*#__PURE__*/_react.default.createElement(_SyncedBlockErrorComponent.SyncedBlockErrorComponent, {
56
59
  error: _editorSyncedBlockProvider.SyncBlockError.Offline
57
60
  });
@@ -58,6 +58,7 @@ export const SyncedBlockErrorComponent = ({
58
58
  /*#__PURE__*/
59
59
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
60
60
  React.createElement("div", {
61
+ "data-testid": "sync-block-error",
61
62
  className: SyncBlockSharedCssClassName.error
62
63
  }, getErrorContent)
63
64
  );
@@ -38,13 +38,16 @@ const SyncedBlockRendererComponent = ({
38
38
  };
39
39
  }, [syncBlockRendererOptions, ssrProviders]);
40
40
  const {
41
- isInternetOffline
41
+ isCollabOffline
42
42
  } = useSharedPluginStateWithSelector(api, ['connectivity'], ({
43
43
  connectivityState
44
44
  }) => ({
45
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
45
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
46
46
  }));
47
- if (isInternetOffline) {
47
+
48
+ // Show offline error only when collaboration is offline and not in SSR mode
49
+ // In SSR, we should always attempt to render content
50
+ if (isCollabOffline && !isSSR()) {
48
51
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
49
52
  error: SyncBlockError.Offline
50
53
  });
@@ -56,6 +56,7 @@ export var SyncedBlockErrorComponent = function SyncedBlockErrorComponent(_ref)
56
56
  /*#__PURE__*/
57
57
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
58
58
  React.createElement("div", {
59
+ "data-testid": "sync-block-error",
59
60
  className: SyncBlockSharedCssClassName.error
60
61
  }, getErrorContent)
61
62
  );
@@ -38,11 +38,14 @@ var SyncedBlockRendererComponent = function SyncedBlockRendererComponent(_ref) {
38
38
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (_ref2) {
39
39
  var connectivityState = _ref2.connectivityState;
40
40
  return {
41
- isInternetOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
41
+ isCollabOffline: (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'collab-offline'
42
42
  };
43
43
  }),
44
- isInternetOffline = _useSharedPluginState.isInternetOffline;
45
- if (isInternetOffline) {
44
+ isCollabOffline = _useSharedPluginState.isCollabOffline;
45
+
46
+ // Show offline error only when collaboration is offline and not in SSR mode
47
+ // In SSR, we should always attempt to render content
48
+ if (isCollabOffline && !isSSR()) {
46
49
  return /*#__PURE__*/React.createElement(SyncedBlockErrorComponent, {
47
50
  error: SyncBlockError.Offline
48
51
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-synced-block-renderer",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "SyncedBlockRenderer for @atlaskit/editor-plugin-synced-block",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/button": "^23.9.0",
32
32
  "@atlaskit/css": "^0.19.0",
33
33
  "@atlaskit/editor-plugin-synced-block": "^5.3.0",
34
- "@atlaskit/editor-synced-block-provider": "^3.13.0",
34
+ "@atlaskit/editor-synced-block-provider": "^3.14.0",
35
35
  "@atlaskit/heading": "^5.2.0",
36
36
  "@atlaskit/icon": "^30.0.0",
37
37
  "@atlaskit/icon-lab": "^5.14.0",