Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: use nc-theme parameter to avoid conflict with form fields

Pranav C5b3a40c58caf
diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue
index 64735e47fc..6032dd9585 100644
--- a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue
+++ b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue
@@ -321,8 +321,9 @@ function sharedViewUrl(withPrefill = true) {
}
// Add theme parameter if defaultTheme is set
+ // Use 'nc-theme' to avoid conflicts with user form fields named 'theme'
if (defaultTheme.value) {
- queryParams.push(`theme=${defaultTheme.value}`)
+ queryParams.push(`nc-theme=${defaultTheme.value}`)
}
return `${encodeURI(baseUrl)}${queryParams.length > 0 ? `?${queryParams.join('&')}` : ''}`
@@ -595,7 +596,7 @@ const copyCustomUrl = async (custUrl = '') => {
<div class="text-nc-content-gray-extreme flex items-center space-x-1">
<div>Default Theme</div>
<NcTooltip class="flex items-center">
- <template #title>Set the default theme (light or dark) for this shared form</template>
+ <template #title>Set the default theme (light or dark) for this shared form. Adds ?nc-theme=light or ?nc-theme=dark to the URL.</template>
<GeneralIcon icon="info" class="flex-none text-gray-400 cursor-pointer"></GeneralIcon>
</NcTooltip>
</div>
diff --git a/packages/nc-gui/composables/useTheme.ts b/packages/nc-gui/composables/useTheme.ts
index fdfbd0c26b..b8ca1297e0 100644
--- a/packages/nc-gui/composables/useTheme.ts
+++ b/packages/nc-gui/composables/useTheme.ts
@@ -237,8 +237,10 @@ export const useTheme = createSharedComposable(() => {
}
// Check for theme query parameter on shared views (without persisting to localStorage)
- if (isSharedViewRoute(route.value) && route.value.query?.theme) {
- const queryTheme = route.value.query.theme as string
+ // Use 'nc-theme' to avoid conflicts with user form fields named 'theme'
+ const themeParam = route.value.query?.['nc-theme'] || route.value.query?.theme
+ if (isSharedViewRoute(route.value) && themeParam) {
+ const queryTheme = themeParam as string
if (['light', 'dark'].includes(queryTheme)) {
selectedTheme.value = queryTheme as 'light' | 'dark'
}