@ray-js/code-sandbox 0.0.7-beta-13 → 0.0.7-beta-14

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.
@@ -1,4 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /* eslint-disable no-await-in-loop */
2
3
  import { Skeleton } from 'antd';
3
4
  import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
4
5
  import { getComponentResource } from '../../services';
@@ -107,22 +108,16 @@ export const CodeEditor = /*#__PURE__*/React.forwardRef((_ref, parentRef) => {
107
108
  };
108
109
  }, [show, fileName]);
109
110
  useEffect(() => {
110
- const destroyOnClose = () => {
111
+ return () => {
111
112
  const api = ref.current;
112
- if (!show) {
113
- if (api) {
114
- const model = api.getModel();
115
- if (model) {
116
- model.dispose();
117
- }
113
+ if (api) {
114
+ const model = api.getModel();
115
+ if (model) {
116
+ model.dispose();
118
117
  }
119
118
  }
120
119
  };
121
- destroyOnClose();
122
- return () => {
123
- destroyOnClose();
124
- };
125
- }, [show]);
120
+ }, []);
126
121
  useImperativeHandle(parentRef, () => ref.current);
127
122
  const loaderConfig = {
128
123
  paths: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/code-sandbox",
3
- "version": "0.0.7-beta-13",
3
+ "version": "0.0.7-beta-14",
4
4
  "description": "小程序 CodeSandbox 容器",
5
5
  "main": "lib/index",
6
6
  "files": [