Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/views/preview/project-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Preview extends React.Component {
'addEventListeners',
'doShare',
'fetchCommunityData',
'fetchDynamicAssets',
'handleAddComment',
'handleClickLogo',
'handleDeleteComment',
Expand Down Expand Up @@ -227,6 +228,7 @@ class Preview extends React.Component {
adminPanelOpen: adminPanelOpen || false,
clientFaved: false,
clientLoved: false,
dynamicAssets: {},
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial state is set to an empty object, but there's no handling for the loading state. Consider adding a loading flag or checking if dynamicAssets is empty in the GUI to distinguish between 'not yet loaded' and 'loaded with no assets'.

Suggested change
dynamicAssets: {},
dynamicAssets: {},
dynamicAssetsLoading: true,

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's a design question here about whether or not to show a spinner (or something) to indicate that it's loading. That said, this specific suggestion doesn't seem necessary even if we do end up wanting a loading indicator.

extensions: [],
socialOpen: false,
favoriteCount: 0,
Expand Down Expand Up @@ -255,6 +257,7 @@ class Preview extends React.Component {
this.setScreenFromOrientation();
}
componentDidMount () {
this.fetchDynamicAssets();
this.addEventListeners();

// It's possible that the session was fetched before this constructor
Expand Down Expand Up @@ -394,6 +397,24 @@ class Preview extends React.Component {
}
}

fetchDynamicAssets () {
api({
host: '',
uri: '/mediagallery/dynamic-assets/'
}, (err, body, res) => {
if (err || (res && res.statusCode >= 400)) {
log.error('Failed to load dynamic assets', {
error: err,
statusCode: res && res.statusCode
});
return;
}
if (body) {
this.setState({dynamicAssets: body});
}
});
}

updateLocalThumbnailFromBlob (blob) {
const reader = new FileReader();

Expand Down Expand Up @@ -1141,6 +1162,7 @@ class Preview extends React.Component {
projectName={this.props.projectInfo.title}
/>
<IntlGUIWithProjectHandler
dynamicAssets={this.state.dynamicAssets}
assetHost={this.props.assetHost}
authorId={this.props.authorId}
authorThumbnailUrl={this.props.authorThumbnailUrl}
Expand Down
Loading