Description
Initial checklist
- Is this really a problem?
- I have searched the Github Issues for similar issues, but did not find anything.
Problem
On the newest version of Univer (^0.5), the spreadsheet does not appear if the html container does not yet exist at the time of Univer's creation. I come from an earlier version of Univer where this wasn't a problem. But I need to update to latest univer and I can't find a solution to a problem without major refactor across several files 🫠.
At previous version, the spreadsheet appeared if the container were created a little bit after Univer's creation, but now it just never appears.
More context:
I setup the Redi context on a higher level in my provider tree:
return (
<UniverApiContext.Provider value={store}>
<RediContext.Provider value={store.injector}>
{children}
<SetExtraHelperFunctions />
</RediContext.Provider>
</UniverApiContext.Provider>
);
and a few components down the tree call useDependency, that's why the Redi context is needed (custom UI). But the div container for the spreadsheet only appears down on that tree, so it does not yet exist when making the univer instance with const { univerAPI } = createUniver({ locale: LocaleType.EN_US, locales: { enUS: Tools.deepMerge( {}, UniverPresetSheetsCoreEnUS, ), }, theme: defaultTheme, presets: [ UniverSheetsCorePreset(), ], });
even though the spreadsheet is only created after the div is available (univerAPI.createUniverSheet({ name: 'Test Sheet' });
).