I noticed an issue with the "hs theme preview", when I up and run the example page which contains the global module (with modified settings in the global editor) - the data is missing - it looks like HS doesn't fetch the data but instead serves the ones defined from the fileds.json file
you're guessing right. The "hs theme preview" command creates only a local preview of the locally available theme elements like CSS, JS, JSON, modules and templates.
It is not connected to HS in any way.
Therefore - changes you apply to global modules inside your portal won't be displayed in the theme preview.
Kinda odd, but the theme preview command was implemented to let a developer check for major issues before uploading it to a portal. Since even the default placeholding menu we all know (the one that gets displayed in a menu module until you select a real menu) is rendered by HubSpot - not a template or JSON file anyone outside of HubSpot can access. And this leads to the case that a menu is not being rendered in the hs theme preview.
If you like to test the menu - I'd recommend to upload the theme to a test portal and test the "real case scenario" in this test portal. Once testing is done, move the files to the live portal.
The most interesting thing is that when I use a global partial containing non-global modules (but HS treats them as global), everything works fine and I can see the updated data.
you're guessing right. The "hs theme preview" command creates only a local preview of the locally available theme elements like CSS, JS, JSON, modules and templates.
It is not connected to HS in any way.
Therefore - changes you apply to global modules inside your portal won't be displayed in the theme preview.
Kinda odd, but the theme preview command was implemented to let a developer check for major issues before uploading it to a portal. Since even the default placeholding menu we all know (the one that gets displayed in a menu module until you select a real menu) is rendered by HubSpot - not a template or JSON file anyone outside of HubSpot can access. And this leads to the case that a menu is not being rendered in the hs theme preview.
If you like to test the menu - I'd recommend to upload the theme to a test portal and test the "real case scenario" in this test portal. Once testing is done, move the files to the live portal.
Let's say I have classic modules (local and native - like RichText) that are on template X and based on it I have page Y. When I modify content on the page (page Y) the changes are visible when I preview the page in local mode.
So since the data are not connectedwith HS (as you wrote), the data should not be visible as well but I can see the changes, that's why I assumed that the lack of data on the global module is a bug
Aug 10, 20243:16 PM - last edited
a month ago
by sharonlicari
Member
HS Theme Preview - Global Module Issue
SOLVE
It sounds like you're experiencing an issue where the example page in the HubSpot theme preview isn't displaying the expected data from the global module, instead defaulting to the data defined in the `fields.json` file. This can happen for several reasons. Here's how you might address it:
### 1. **Confirm Changes in the Global Editor:** - Double-check that the changes you made in the global editor were saved correctly. Sometimes, if changes aren't saved properly, the preview might revert to using the default data from the `fields.json` file.
### 2. **Republish the Global Module:** - After making changes in the global editor, try republishing the global module. This can help ensure that the most recent changes are applied and fetched when the theme preview is generated.
### 3. **Clear HubSpot Cache:** - HubSpot may serve cached data, especially in preview mode. Clearing the cache or even trying a hard refresh (Ctrl+F5) might help in loading the updated data.
### 4. **Check Field Definitions in `fields.json`:** - Ensure that the fields defined in the `fields.json` file match the fields used in the global module. If there's a mismatch or missing field, HubSpot might default to the data in `fields.json`.
### 5. **Inspect for Conditional Logic or Overrides:** - If there is any conditional logic or overrides in your module’s code that determines which data source to use, verify that it’s correctly implemented. Sometimes, the logic might inadvertently force the use of default data instead of fetching the updated data.
### 6. **Test in a Live Environment:** - Sometimes, issues in the preview mode don’t occur in the live environment. If possible, test the module in a live environment to see if the issue persists.
### 7. **Look for Known Issues or Updates:** - Check if there are any known issues or updates in the HubSpot developer community or documentation regarding global modules and data fetching. Occasionally, platform updates or bugs might affect functionality.
We need to continue exploring all possible avenues to pinpoint the root cause of the issue. If you'd like to take this to our support team, you're more than welcome to do so