From 17d1068a60efd337ec373ab27e626185aef896b0 Mon Sep 17 00:00:00 2001 From: Brian Joseph Petro Date: Fri, 20 Dec 2024 16:21:28 -0500 Subject: [PATCH] Add render_component helper method to Collection class - Introduced a new async method `render_component` in the Collection class to facilitate rendering components within the collection scope. - This method enhances the modularity and reusability of the rendering logic, allowing for better integration of components in the collection context. --- smart-collections/collection.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/smart-collections/collection.js b/smart-collections/collection.js index 1b529a2f..588ad30e 100644 --- a/smart-collections/collection.js +++ b/smart-collections/collection.js @@ -484,5 +484,14 @@ export class Collection { this.notices?.show('done loading', `${this.collection_key} loaded`, { timeout: 3000 }); this.render_settings(); } + /** + * Helper function to render a component in the collection scope + * @param {*} component_key + * @param {*} opts + * @returns + */ + async render_component(component_key, opts = {}) { + return await this.env.render_component(component_key, this, opts); + } }