This repository has been archived by the owner on Jul 12, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache panel contents after first load
Previously: 1) Panels are by default conditionally rendered, so each time a panel is closed and reopened, its contents are recreated. 2) Else, panels can be preloaded if explicitly wanted. However, this adds extra rendering time. Now: Case 2 remains the same. Authors can still choose to preload their panels if they wish. For Case 1, we cache the rendered content so as to prevent re-rendering, which a) prevents multiple HTTP requests if using the src attribute b) solves issues that stem from the destruction and recreation of components: MarkBind/markbind#868 MarkBind/markbind#483 Implementation: Store an additional `isCached` property, which is set to true whenever the content is fetched. When `isCached` is true, we switch from v-if (conditional rendering) to v-show (conditional display) More info: https://vuejs.org/v2/guide/conditional.html#v-show As a side effect, since once the panel is loaded v-show is always used, the v-else part of the template is not needed anymore. Future work: Investigate the use of keep-alive: https://vuejs.org/v2/guide/components-dynamic-async.html Tried to surround the content with <keep-alive></keep-alive> but did not seem to be cached.
- Loading branch information