Skip to content

Commit 7b8c38e

Browse files
fix(public): skip disabled template metadata query
1 parent 269e75a commit 7b8c38e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

apps/sim/app/templates/[id]/page.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ function getUnavailableTemplateMetadata(): Metadata {
2626
}
2727

2828
async function getPublicTemplateMetadataRecord(id: string) {
29+
if (!isPublicTemplatesPagesEnabled) {
30+
return null
31+
}
32+
2933
const result = await db
3034
.select({
3135
template: templates,
@@ -42,7 +46,7 @@ async function getPublicTemplateMetadataRecord(id: string) {
4246

4347
const [{ template, creator }] = result
4448

45-
if (!isPublicTemplatesPagesEnabled || template.status !== 'approved') {
49+
if (template.status !== 'approved') {
4650
return null
4751
}
4852

apps/sim/app/templates/public-pages.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ describe('public templates pages', () => {
147147
follow: false,
148148
},
149149
})
150+
expect(mockTemplateMetadataSelect).not.toHaveBeenCalled()
150151
})
151152

152153
it('returns noindex metadata for non-approved templates', async () => {

0 commit comments

Comments
 (0)