From 839390f820157f09108b9f34348456acc9d82256 Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Sat, 2 Aug 2025 15:45:34 -0500 Subject: [PATCH] attempting to make product load better in drop down --- client/MenuItems/modalLinkProducts.js | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/client/MenuItems/modalLinkProducts.js b/client/MenuItems/modalLinkProducts.js index 00326ff..8d777d3 100644 --- a/client/MenuItems/modalLinkProducts.js +++ b/client/MenuItems/modalLinkProducts.js @@ -18,17 +18,29 @@ Template.modalLinkProducts.onRendered(function() { dropdownOptions: 4, }); - setTimeout(function() { - var instances = M.Modal.init(elems, {}); - var instancese = M.FormSelect.init(elemse, { - dropdownOptions: 4, - }); - }, 250); + this.autorun(() => { + if (this.subscriptionsReady()) { + // setTimeout(function() { + // var instances = M.Modal.init(elems, {}); + var elemse = document.querySelectorAll('select'); + var instancese = M.FormSelect.init(elemse, { + dropdownOptions: 4, + }); + // }, 250); + } + }); }); Template.modalLinkProducts.helpers({ products: function() { - return Products.find({}, {sort: { prodName:1 }}); + let prodInfo = Products.find({}, { sort: { prodName:1 }}); + // return Products.find({}, {sort: { prodName:1 }}); + if (!prodInfo) { + console.log("no product info yet."); + } else { + console.log("prod info found."); + return prodInfo; + } } }); @@ -79,4 +91,4 @@ Template.modalLinkProducts.events({ } } } -}); +}); \ No newline at end of file