@lark-apaas/miaoda-core 0.1.0-alpha.17 → 0.1.0-alpha.19

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.
@@ -16,18 +16,14 @@ var IframeBridge_RouteMessageType = /*#__PURE__*/ function(RouteMessageType) {
16
16
  function isRouteMessageType(type) {
17
17
  return Object.values(IframeBridge_RouteMessageType).includes(type);
18
18
  }
19
- function listenHot() {}
20
19
  async function connectParent() {
21
- connectToParent({
20
+ const connection = connectToParent({
22
21
  parentOrigin: getPreviewParentOrigin(),
23
22
  methods: {
24
23
  ...childApi
25
24
  }
26
25
  });
27
- }
28
- if ('production' !== process.env.NODE_ENV) {
29
- listenHot();
30
- connectParent();
26
+ await connection.promise;
31
27
  }
32
28
  function IframeBridge() {
33
29
  const location = useLocation();
@@ -60,6 +56,7 @@ function IframeBridge() {
60
56
  type: 'PreviewReady',
61
57
  data: {}
62
58
  });
59
+ connectParent();
63
60
  }, []);
64
61
  useEffect(()=>{
65
62
  if (isActive.current) {
@@ -23,9 +23,9 @@ const createDataLoomClient = (url, pat)=>{
23
23
  let dataloom = null;
24
24
  async function getDataloom() {
25
25
  if (dataloom) return dataloom;
26
- const { app_runtime_extra } = await getInitialInfo();
27
- const DATALOOM_CLIENT_URL = app_runtime_extra?.url;
28
- const DATALOOM_PAT = app_runtime_extra?.token;
26
+ const info = await getInitialInfo();
27
+ const DATALOOM_CLIENT_URL = info?.app_runtime_extra?.url;
28
+ const DATALOOM_PAT = info?.app_runtime_extra?.token;
29
29
  dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
30
30
  return dataloom;
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-core",
3
- "version": "0.1.0-alpha.17",
3
+ "version": "0.1.0-alpha.19",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [