Skip to content

Commit

Permalink
Add render_component helper method to Collection class
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Brian Joseph Petro committed Dec 20, 2024
1 parent e525dd3 commit 17d1068
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions smart-collections/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 17d1068

Please sign in to comment.