I am working on a webapp that is served up "modules/widgets" that dynamically register themselves to GoldenLayout. The layout config is persisted and applied on startup to retain the user's window layout. Due to a number of different factors, a "module/widget" that was available to them could be removed. If that user had that "module/widget" out on their screen the last time they were logged in it is saved in the goldenlayout config. WHen the user next logs in they receive a "Configuration Error" for an "unknown component". Is there a way for GoldenLayout to just ignore unknown compoenents listed in the config?
Asked
Active
Viewed 279 times
2
-
How did you solve this? I have the issue and working on how to handle the "unknown component" problem... – Amir Sep 13 '22 at 12:04
1 Answers
0
I will post my solution for future reference:
- layout fails on command layout.init()
- this is an edge case for us => happens when users disable some component via feature toggle or when test team loads and old application version that does not yet contain the component
- we do not want to implement any complex solution to analyze layout and remove specific view but have the most robust solution => restore default layout
Here is how I solved it:
try {
this.layout.init();
} catch (e) {
console.error('Layout initialization failed', e);
// => delete persisted layout
// => display some toast notification that layout initialization has failed and reload/restore will happen
setTimeout(() => location.reload(), 5000); // reload with default layout (no persisted layout present)
return;
}

Amir
- 211
- 3
- 14