CMS Development

Dawidk
Participant | Diamond Partner
Participant | Diamond Partner

HS Theme Preview - Global Module Issue

SOLVE

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

1 Accepted solution
Anton
Solution
Thought Leader

HS Theme Preview - Global Module Issue

SOLVE

Hi @Dawidk

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. 

 

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

0 Upvotes
9 Replies 9
Dawidk
Participant | Diamond Partner
Participant | Diamond Partner

HS Theme Preview - Global Module Issue

SOLVE

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.

0 Upvotes
Anton
Solution
Thought Leader

HS Theme Preview - Global Module Issue

SOLVE

Hi @Dawidk

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. 

 

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
Dawidk
Participant | Diamond Partner
Participant | Diamond Partner

HS Theme Preview - Global Module Issue

SOLVE

Hi Anton!

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.

Dawidk_0-1723391195588.png

 

So since the data are not connected with 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

0 Upvotes
akhan336
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.

### 8. **Rebuild the Module:**

0 Upvotes
Humashankar
Key Advisor

HS Theme Preview - Global Module Issue

SOLVE

@Dawidk 

Thanks for confirming on that part, as a next step we must review environment variables, and local server configurations.

Regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
0 Upvotes
Dawidk
Participant | Diamond Partner
Participant | Diamond Partner

HS Theme Preview - Global Module Issue

SOLVE

So the issue is on the HS side? And I should wait for the fix?

Humashankar
Key Advisor

HS Theme Preview - Global Module Issue

SOLVE

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

Help Center (hubspot.com)

Humashankar_0-1723308131853.png

Regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
0 Upvotes
Humashankar
Key Advisor

HS Theme Preview - Global Module Issue

SOLVE

Hi @Dawidk 

Kindly try refreshing your browser's cache or try from a private browsing window to access the preview.

This may help resolve the problem and provide a clearer view.

 

Hope this helps - Happy to help further!!
Thank you very much and have a great one!
Warm regards

Humashankar VJ
HubSpot Community Champion and enthusiast | Engineering Manager
0 Upvotes
Dawidk
Participant | Diamond Partner
Participant | Diamond Partner

HS Theme Preview - Global Module Issue

SOLVE

doesn't work - menu items are still unavailable on the local env

Dawidk_0-1723295633673.png

 

0 Upvotes