Is it okay to add your own properties into the 'SC' object that is globally accessible?
(I'm developing extensions for SC 2019.2)
s
Steve Goldberg
01/30/2020, 5:13 PM
It's not great
v
Viraj Shinde
01/30/2020, 5:17 PM
I want to add some common properties that need to be consumed by Views from multiple extensions. I cannot fire queries to the back-end to refetch that info for every extension.
What will be an ideal way to share that data? (Something like the SC global object.)
s
Steve Goldberg
01/30/2020, 5:20 PM
Depends on your data. We're pretty keen on using cached models and collections and then returning them as singletons
Steve Goldberg
01/30/2020, 5:21 PM
You could also use the configuration record if they're site-wide values
v
Viraj Shinde
01/31/2020, 12:49 PM
Yes, we're using the Configuration record for storing static values/configuration. But the info I'm trying to make global is dynamic (it should be fetched once every time the web store loads - a particular URL) and then made available for multiple Views.