Hello hello.
I noticed strange behavior when multiple custom components are in the same app.
I dug around to figure out if it was something weird with the way I was importing the vendor CSS or what and found the culprit.
When provideDependencies receives a different manifest, it:
- compares
JSON.stringifyvalues - clears the shared module cache
- then removes every stylesheet link in the accidentally(?) shared cache -
a4below:
provideDependencies(t) {
this.dependencies && JSON.stringify(this.dependencies) !== JSON.stringify(t) && (Object.keys(l0$1).forEach(o => delete l0$1[o]),
Object.keys(a4).forEach(o => {
let r = a4[o];
r.parentNode?.removeChild(r),
delete a4[o]
}
)),
this.dependencies = t
}
An existing sibling component can therefore lose its vendor stylesheet while its rendered content remains present.
Reproduction:
- Create two custom components that utilize different vendor CSS imports.
- tabulator-tables and react-big-calendar, for example:
- In
uib-tabulator→@/app/app.tsx:import 'tabulator-tables/dist/css/tabulator.min.css'; - In
uib-rbc→@/app/app.tsx:import 'calendar/lib/css/react-big-calendar.css';
- In
- tabulator-tables and react-big-calendar, for example:
- Place both within the same UIB app.
- Reload page and check header tags for vendor CSS links.
- Observe that only the final custom component to initialize retains it’s vendor CSS link; all others are removed.
Workaround:
- Manually add vendor CSS as custom component local files.
Create uib-tabulator → @/tabulator.min.css and copy the vendor CSS into it.
Then, in @/app/app.tsx:
/* import 'tabulator-tables/dist/css/tabulator.min.css'; */
import '@/tabulator.min.css';
Hope this helps!