Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree. #6657

Closed
daimall opened this issue Apr 20, 2023 · 0 comments · Fixed by #7301
Assignees

Comments

@daimall
Copy link

daimall commented Apr 20, 2023

描述问题:

页面加载时报如下错误,不影响界面操作,第一次加载当前页面没问题,再次加载一直出现
Uncaught (in promise) Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree. (Object type: 'ServiceStore', Path upon death: '', Subpath: 'data', Action: ''). Either detach nodes first, or don't use objects after removing / replacing them in the tree.
at fail$1 (mobx-state-tree.module.js:3128:1)
at ObjectNode.assertAlive (mobx-state-tree.module.js:1508:1)
at ObjectNode.unbox (mobx-state-tree.module.js:1580:1)
at ObservableValue.dehanceValue (mobx.module.js:1062:1)
at ObservableValue.get (mobx.module.js:1115:1)
at ObservableObjectAdministration.read (mobx.module.js:4139:1)
at Object.get [as data] (mobx.module.js:4324:1)
at PageRenderer. (Page.js:109:1)
at step (tslib.es6.js:102:1)
at Object.next (tslib.es6.js:83:1)

截图或视频:

image

如何复现(请务必完整填写下面内容):

npm react组件的形式,代码如下:

import React from 'react';

import 'amis/lib/themes/default.css';
import 'amis/lib/helper.css';

import request from 'src/utils/request'

import '@fortawesome/fontawesome-free/css/all.css';
import '@fortawesome/fontawesome-free/css/v4-shims.css';

import axios from 'axios';
import copy from 'copy-to-clipboard';

import { render as renderAmis, ToastComponent, AlertComponent } from 'amis';
import { toast } from 'amis-ui';

// amis 环境配置
const env = {
// 下面三个接口必须实现
fetcher: ({
url, // 接口地址
method, // 请求方法 get、post、put、delete
data, // 请求数据
responseType,
config, // 其他配置
headers // 请求头
}: any) => {
return request({
url: url,
method: method,
data
})
},
isCancel: (value: any) => (axios as any).isCancel(value),
copy: (content: string) => {
copy(content);
toast.success('内容已复制到粘贴板');
}
};

class AMISComponent extends React.Component<any, any> {
render() {
return renderAmis(
this.props.amisJson,
{
// props...
},
env
);
}
}

export default AMISComponent;

  1. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    amis 2.9.0(2.4.0版本没有问题,后续的版本都有该问题)

  2. 粘贴有问题的完整 amis schema 代码:

和amis schema无关的
  1. 操作步骤
    点击同一个左边的菜单,两次后就必然出现(只有第一次不出现)
@2betop 2betop self-assigned this Jun 5, 2023
hsm-lv added a commit that referenced this issue Jun 29, 2023
fix: 修复 Page 组件快速切换可能的 warning 报错 Close: #6657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants