-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
[Bug] UMD method introduces universal. Error: [redi]: Injector cannot be accessed after it was disposed. #2351
Comments
Origin Title: [Bug] UMD方式引入univer。执行dispose后报错 Error: [redi]: Injector cannot be accessed after it was disposed Title: [Bug] UMD method introduces universal. Error: [redi]: Injector cannot be accessed after it was disposed. Before you submitted this question, did you check the following?
Affected packages and versionslatest package Recurrence linkReproduction example: If you click destroy to execute the univer instance, dispose will report an error. The reproduction code is below. This is an online reproduction demo: The complete html code will be formatted. So keep it separate. Import the html head tag into cdn:
` html body tag: Script code: ` Expected behaviorIt should be destroyed correctly and no errors should be reported. Actual behaviorIf the actual destruction is executed and dispose is executed, an error will be reported. Error: [redi]: Injector cannot be accessed after it was disposed Running environmentChrome system messageNo response |
在您提交此问题之前,您是否检查了以下内容?
受影响的包和版本
最新的包
复现链接
复现例子:点销毁执行univer实例的,dispose就会报错,复现代码放到下面。
这是在线的复现demo:
码上掘金在线demo
完整的html代码会被格式化掉。所以分开放。
html head标签引入引入cdn:
<script src="https://unpkg.com/@univerjs/umd/lib/univer.full.umd.js"></script>`
`
html body标签:
<button id="destroy">销毁</button> <button id="load">加载</button>
脚本代码:
<script> var { UniverCore, UniverDesign, UniverDocs, UniverDocsUi, UniverEngineRender, UniverSheetsFormula, UniverUi, UniverSheets, UniverSheetsUi, UniverSheetsNumfmt, UniverEngineFormula, } = window var univer = new UniverCore.Univer({ theme: UniverDesign.defaultTheme, }); univer.registerPlugin(UniverEngineRender.UniverRenderEnginePlugin); univer.registerPlugin(UniverEngineFormula.UniverFormulaEnginePlugin); univer.registerPlugin(UniverUi.UniverUIPlugin, { container: "app", }); univer.registerPlugin(UniverDocs.UniverDocsPlugin, { hasScroll: false, }); univer.registerPlugin(UniverDocsUi.UniverDocsUIPlugin); univer.registerPlugin(UniverSheets.UniverSheetsPlugin); univer.registerPlugin(UniverSheetsUi.UniverSheetsUIPlugin); univer.registerPlugin(UniverSheetsNumfmt.UniverSheetsNumfmtPlugin); univer.registerPlugin(UniverSheetsFormula.UniverSheetsFormulaPlugin); univer.createUnit(UniverCore.UniverInstanceType.UNIVER_SHEET, {}) var univerAPI = UniverFacade.FUniver.newAPI(univer) // Functionality for the "销毁" button document.getElementById('destroy').addEventListener('click', function() { // 手动清理 Univer 实例 univer.dispose(); }); // Function to reload the Univer instance function reloadUniver() { univer = new UniverCore.Univer({ theme: UniverDesign.defaultTheme, }); univer.registerPlugin(UniverEngineRender.UniverRenderEnginePlugin); univer.registerPlugin(UniverEngineFormula.UniverFormulaEnginePlugin); univer.registerPlugin(UniverUi.UniverUIPlugin, { container: "app", }); univer.registerPlugin(UniverDocs.UniverDocsPlugin, { hasScroll: false, }); univer.registerPlugin(UniverDocsUi.UniverDocsUIPlugin); univer.registerPlugin(UniverSheets.UniverSheetsPlugin); univer.registerPlugin(UniverSheetsUi.UniverSheetsUIPlugin); univer.registerPlugin(UniverSheetsNumfmt.UniverSheetsNumfmtPlugin); univer.registerPlugin(UniverSheetsFormula.UniverSheetsFormulaPlugin); univer.createUnit(UniverCore.UniverInstanceType.UNIVER_SHEET, {}); } // Functionality for the "加载" button document.getElementById('load').addEventListener('click', function() { reloadUniver(); // Reload the Univer instance }); </script>`
`
预期行为
应该正确销毁,不要报错才对
实际行为
实际销毁执行dispose就报错
Error: [redi]: Injector cannot be accessed after it was disposed
运行环境
Chrome
系统信息
No response
The text was updated successfully, but these errors were encountered: