我是第一次React-admin用户(也是现代JS的新手)。我一直在使用react-admin为我正在从事的项目构建管理Web界面。
管理Web用来管理客户端计算机上文件中的需求数据的某些资源。我根据官方文档将FileInput
组件与嵌套的FileField
组件一起使用来获取它们,然后使用文档中概述的包装器方法包装dataProvider
实例来处理文件句柄并读取数据。单击“保存”按钮后,请求将正确地分派到服务器,然后服务器将处理该请求并将数据存储在数据库中。
我面临的问题是,当响应返回时,会弹出一条通知,提示Cannot read property 'hasOwnProperty' of undefined
,并且控制台包含两个相同的回溯:
index.js:1375 Warning: Missing translation for key: "Cannot read property 'hasOwnProperty' of undefined"
in Notification (created by Connect(Notification))
in Connect(Notification) (created by WithStyles(Connect(Notification)))
in WithStyles(Connect(Notification)) (created by Context.Consumer)
in Context.Consumer (created by translate(WithStyles(Connect(Notification))))
in translate(WithStyles(Connect(Notification))) (created by Layout)
in Layout (created by WithStyles(Layout))
in WithStyles(Layout) (created by Route)
in Route (created by withRouter(WithStyles(Layout)))
in withRouter(WithStyles(Layout)) (created by Connect(withRouter(WithStyles(Layout))))
in Connect(withRouter(WithStyles(Layout))) (created by LayoutWithTheme)
in LayoutWithTheme (created by Route)
in Route (created by CoreAdminRouter)
in CoreAdminRouter (created by Connect(CoreAdminRouter))
in Connect(CoreAdminRouter) (created by getContext(Connect(CoreAdminRouter)))
in getContext(Connect(CoreAdminRouter)) (created by Route)
in Route (created by CoreAdminBase)
in CoreAdminBase (created by withContext(CoreAdminBase))
in withContext(CoreAdminBase) (at App.js:46)
in App (at src/index.js:7)
Firefox报告的错误有所不同,但回溯是相同的:
Warning: Missing translation for key: "response is undefined"
in Notification (created by Connect(Notification))
in Connect(Notification) (created by WithStyles(Connect(Notification)))
in WithStyles(Connect(Notification)) (created by Context.Consumer)
in Context.Consumer (created by translate(WithStyles(Connect(Notification))))
in translate(WithStyles(Connect(Notification))) (created by Layout)
in Layout (created by WithStyles(Layout))
in WithStyles(Layout) (created by Route)
in Route (created by withRouter(WithStyles(Layout)))
in withRouter(WithStyles(Layout)) (created by Connect(withRouter(WithStyles(Layout))))
in Connect(withRouter(WithStyles(Layout))) (created by LayoutWithTheme)
in LayoutWithTheme (created by Route)
in Route (created by CoreAdminRouter)
in CoreAdminRouter (created by Connect(CoreAdminRouter))
in Connect(CoreAdminRouter) (created by getContext(Connect(CoreAdminRouter)))
in getContext(Connect(CoreAdminRouter)) (created by Route)
in Route (created by CoreAdminBase)
in CoreAdminBase (created by withContext(CoreAdminBase))
in withContext(CoreAdminBase) (at App.js:46)
in App (at src/index.js:7)
服务器的响应包含修改后的实体的数据,但是它不包含原始文件数据,因为我认为管理网络不再需要该数据。该文档似乎没有指定FileInput
组件期望在响应中收到的内容(如果有的话),因此,当我尝试查找并解决此问题时,我尝试发送回一个空缓冲区并还有一个空结构,其属性名称与为FileInput
源定义的属性名称相同,但似乎没有任何作用。我确实知道,当我完全禁用FileInput
组件时,不会发生此错误。
我已经处理问题好几个小时了,我觉得自己已经走到了尽头,因此,我们将不胜感激任何其他见解。预先感谢。