stable
Clone or download
The artidoc document is displayed in readonly mode first, and then user chooses a section to be edited. There is no need to have a bundle that contains readonly and edition at the same time. User might not want to edit anything, or they might not even have the right to do so at all. The proposal is to load the SectionDescriptionEditor only when needed by using async components: https://vuejs.org/guide/components/async This reduces the size of the bundle. For example without this patch: ``` frontend-assets/assets/artidoc-HYjMz0He.js 1,487.67 kB âšī¸ ``` With this patch: ``` frontend-assets/assets/artidoc-_c7d0E0d.js 185.48 kB đ frontend-assets/assets/SectionDescriptionEditor-jvvSaJQg.js 1,300.27 kB ``` The first page load will be faster. Asynchronous loading comes with drawbacks: The load of the async component might fail, should we provide an error state in that case? The load of the async component might takes some time due to network latency. Even on a local dev environment, this causes flickering because the readonly description disappear during the load of the editor. In order to mitigate that, the readonly description is used as a loading state. Part of story #37543: edit Artidoc sections Change-Id: Ic16f8243605a035ca1d1dce9fccd8948700ac426
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/artidoc/scripts/artidoc/src/components/SectionDescription.test.ts | +9 | â31 | Go to diff View file |
M | plugins/artidoc/scripts/artidoc/src/components/SectionDescription.vue | +19 | â9 | Go to diff View file |
A | plugins/artidoc/scripts/artidoc/src/components/description/SectionDescriptionReadOnly.test.ts | +40 | â0 | Go to diff View file |
A | plugins/artidoc/scripts/artidoc/src/components/description/SectionDescriptionReadOnly.vue | +36 | â0 | Go to diff View file |