Skip to content

Beautiful Open-Source Form Builder

New UI bug fixes

Julien Nahum6dcdd954776a
diff --git a/.cursor/rules/api-query.mdc b/.cursor/rules/api-query.mdc
index a739a0135..3af30c337 100644
--- a/.cursor/rules/api-query.mdc
+++ b/.cursor/rules/api-query.mdc
@@ -28,7 +28,29 @@ alwaysApply: false
- List: `["workspaces", "list"]`
- Item: `["workspaces", id]`
3. **Cache writes after mutations** – Inside `onSuccess` use `queryClient.setQueryData` to update affected caches, then call `invalidate()` only when a true refetch is needed.
-4. **Utilities** – Provide at minimum `invalidate()` (call `queryClient.invalidateQueries({ queryKey: [domain] })`).
+4. **URL parameters in mutations** – Pass URL parameters (like IDs) when creating the mutation, not when executing it. Use `toValue()` to handle reactive values.
+5. **Utilities** – Provide at minimum `invalidate()` (call `queryClient.invalidateQueries({ queryKey: [domain] })`).
+
+### Handling Reactive Parameters
+
+Use `toValue()` when working with reactive values (refs, computed) in mutations and queries:
+
+```js
+const update = (workspaceId, options = {}) => {
+ return useMutation({
+ mutationFn: (data) => workspaceApi.update(toValue(workspaceId), data),
+ onSuccess: (response) => {
+ const id = toValue(workspaceId);
+ // Update caches using the resolved ID...
+ },
+ ...options,
+ });
+};
+
+// Usage in component:
+const { current: workspace } = useCurrentWorkspace();
+const updateMutation = update(workspace.value.id); // ID passed at creation
+```
---
@@ -109,5 +131,7 @@ You normally **don’t** need to add headers manually.
- [ ] Map 1-to-1 with an API module
- [ ] Provide `list`, `detail`, and the necessary mutations
- [ ] Use consistent query keys
+- [ ] Pass URL parameters at mutation creation time, not execution time
+- [ ] Use `toValue()` for reactive parameters (refs, computed)
- [ ] Handle optimistic cache updates in `onSuccess`
- [ ] Expose `invalidate()`
diff --git a/client/api/workspace.js b/client/api/workspace.js
index e552b4ccc..808cf50ee 100644
--- a/client/api/workspace.js
+++ b/client/api/workspace.js
@@ -5,7 +5,9 @@ const BASE_PATH = '/open/workspaces'
export const workspaceApi = {
// Workspace operations
list: (options) => apiService.get(BASE_PATH, options),
+ get: (workspaceId) => apiService.get(`${BASE_PATH}/${workspaceId}`),
create: (data) => apiService.post(`${BASE_PATH}/create`, data),
+ update: (workspaceId, data) => apiService.put(`${BASE_PATH}/${workspaceId}`, data),
delete: (workspaceId) => apiService.delete(`${BASE_PATH}/${workspaceId}`),
leave: (workspaceId) => apiService.post(`${BASE_PATH}/${workspaceId}/leave`),
diff --git a/client/components/dashboard/ScrollableContainer.vue b/client/components/dashboard/ScrollableContainer.vue
new file mode 100644
index 000000000..d7e24307b
--- /dev/null
+++ b/client/components/dashboard/ScrollableContainer.vue
@@ -0,0 +1,94 @@
+<template>
+ <div class="relative">
+ <!-- Top Fade -->
+ <VTransition name="fade">
+ <div
+ v-if="showTopFade"
+ :class="[
+ 'absolute top-0 left-0 right-0 z-10 pointer-events-none',
+ topFadeClasses
+ ]"
+ />
+ </VTransition>
+
+ <!-- Scrollable Content -->
+ <div
+ ref="scrollContainer"
+ :class="[
+ 'overflow-y-auto',
+ maxHeightClass
+ ]"
+ >
+ <slot />
+ </div>
+
+ <!-- Bottom Fade -->
+ <VTransition name="fade">
+ <div
+ v-if="showBottomFade"
+ :class="[
+ 'absolute bottom-0 left-0 right-0 z-10 pointer-events-none',
+ bottomFadeClasses
+ ]"
+ />
+ </VTransition>
+ </div>
+</template>
+
+<script setup>
+import VTransition from '@/components/global/transitions/VTransition.vue'
+import { useScroll, useResizeObserver } from '@vueuse/core'
+
+const props = defineProps({
+ maxHeightClass: {
+ type: String,
+ default: 'max-h-80'
+ },
+ topFadeHeight: {
+ type: String,
+ default: 'h-8'
+ },
+ bottomFadeHeight: {
+ type: String,
+ default: 'h-8'
+ },
+ fadeClass: {
+ type: String,
+ default: 'from-white to-transparent'
+ }
+})
+
+// Scroll fade detection
+const scrollContainer = ref(null)
+const { y: scrollY } = useScroll(scrollContainer)
+const contentHeight = ref(0)
+const containerHeight = ref(0)
+
+const showTopFade = computed(() => scrollY.value > 0)
+const showBottomFade = computed(() => {
+ if (containerHeight.value === 0 || contentHeight.value === 0) return false
+ return scrollY.value < contentHeight.value - containerHeight.value - 1 // -1 for subpixel precision
+})
+
+const topFadeClasses = computed(() => {
+ return `${props.topFadeHeight} bg-gradient-to-b ${props.fadeClass}`
+})
+
+const bottomFadeClasses = computed(() => {
+ return `${props.bottomFadeHeight} bg-gradient-to-t ${props.fadeClass}`
+})
+
+// Update content dimensions when container resizes
+useResizeObserver(scrollContainer, (entries) => {
+ const entry = entries[0]
+ containerHeight.value = entry.contentRect.height
+ if (scrollContainer.value) {
+ contentHeight.value = scrollContainer.value.scrollHeight
+ }
+})
+
+// Expose container ref for parent components that might need it
+defineExpose({
+ scrollContainer
+})
+</script>
\ No newline at end of file
diff --git a/client/components/dashboard/WorkspaceDropdown.vue b/client/components/dashboard/WorkspaceDropdown.vue
index fd444ea5f..742aa2f12 100644
--- a/client/components/dashboard/WorkspaceDropdown.vue
+++ b/client/components/dashboard/WorkspaceDropdown.vue
@@ -1,57 +1,87 @@
<template>
- <UDropdownMenu
+ <UPopover
v-model:open="isDropdownOpen"
v-if="user && workspaces && workspaces.length >= 1"
- :items="dropdownItems"
:content="content"
- v-bind="$attrs"
arrow
+ v-bind="$attrs"
>
<slot :workspace="workspace" />
- <template #workspace-info>
- <div>
- <div class="flex items-center gap-3">
- <WorkspaceIcon size="size-8" :workspace="workspace" />
- <div class="flex-1 min-w-0">
- <p class="text-sm font-medium text-neutral-800 truncate">
- {{ workspace.name }}
- </p>
- <p class="text-xs text-neutral-500">
- {{ workspacePlanText }} • {{ memberCountText }}
- </p>
+ <template #content>
+ <div class="w-60 flex flex-col">
+ <!-- Workspace Info Header -->
+ <div v-if="workspace" class="p-3 border-b border-neutral-200">
+ <div class="flex items-center gap-3">
+ <WorkspaceIcon size="size-8" :workspace="workspace" />
+ <div class="flex-1 min-w-0">
+ <p class="text-sm font-medium text-neutral-800 truncate">
+ {{ workspace.name }}
+ </p>
+ <p class="text-xs text-neutral-500">
+ {{ workspacePlanText }} • {{ memberCountText }}
+ </p>
+ </div>
+ </div>
+ <div class="mt-2 flex items-center gap-2">
+ <UButton
+ icon="i-heroicons-cog-6-tooth"
+ size="xs"
+ color="neutral"
+ variant="outline"
+ @click="openSettings"
+ label="Settings"
+ />
+ <UButton
+ v-if="workspace.is_admin"
+ icon="i-heroicons-user-plus"
+ size="xs"
+ color="neutral"
+ variant="outline"
+ @click="openInviteUserModal"
+ label="Invite Members"
+ />
</div>
</div>
- <div class="mt-2 flex items-center gap-2">
- <UButton
- icon="i-heroicons-cog-6-tooth"
- size="xs"
- color="neutral"
- variant="outline"
- @click="openSettings"
- label="Settings"
- />
+
+ <!-- Workspace List (with ScrollableContainer) -->
+ <div v-if="workspaces.length > 1" class="p-1">
+ <ScrollableContainer max-height-class="max-h-64" top-fade-height="h-10" bottom-fade-height="h-10">
+ <div class="flex flex-col">
+ <UButton
+ v-for="worksp in workspaces"
+ :key="worksp.id"
+ class="w-full flex items-center gap-3 p-2 rounded-md text-left"
+ color="neutral"
+ variant="ghost"
+ @click="switchWorkspace(worksp)"
+ :label="worksp.name"
+ size="sm"
+ :trailing-icon="workspace?.id === worksp?.id ? 'i-heroicons-check' : undefined"
+ >
+ <template #leading>
+ <WorkspaceIcon :workspace="worksp" size="size-5" />
+ </template>
+ </UButton>
+ </div>
+ </ScrollableContainer>
+ </div>
+
+ <!-- Create Workspace Action -->
+ <div class="border-t border-neutral-200 p-1">
<UButton
- v-if="workspace.is_admin"
- icon="i-heroicons-user-plus"
- size="xs"
+ class="w-full flex items-center gap-3 p-2 rounded-md hover:bg-neutral-100 transition-colors text-left"
+ icon="i-heroicons-plus"
color="neutral"
- variant="outline"
- @click="openInviteUserModal"
- label="Invite Members"
+ variant="ghost"
+ @click="createNewWorkspace"
+ label="Create Workspace"
+ size="sm"
/>
</div>
</div>
</template>
-
- <template #item-leading="{ item }">
- <WorkspaceIcon
- v-if="item.workspace"
- :workspace="item.workspace"
- size="size-5"
- />
- </template>
- </UDropdownMenu>
+ </UPopover>
<!-- Create Workspace Modal -->
<CreateWorkspaceModal
@@ -71,6 +101,7 @@ import { computed, ref } from "vue"
import WorkspaceIcon from "~/components/workspaces/WorkspaceIcon.vue"
import CreateWorkspaceModal from "~/components/workspaces/CreateWorkspaceModal.vue"
import WorkspacesSettingsInviteUser from '~/components/workspaces/settings/InviteUser.vue'
+import ScrollableContainer from '~/components/dashboard/ScrollableContainer.vue'
defineProps({
@@ -160,44 +191,7 @@ const openInviteUserModal = () => {
showInviteUserModal.value = true
}
-const dropdownItems = computed(() => {
- if (!user.value || !workspaces.value) return []
-
- const items = []
-
- // Workspace info header (only show if we have a current workspace)
- if (workspace.value) {
- items.push([
- {
- slot: 'workspace-info',
- type: 'label'
- }
- ])
- }
-
- // Workspace selector section (only show if multiple workspaces)
- if (workspaces.value.length > 1) {
- const workspaceItems = workspaces.value.map(worksp => ({
- label: worksp.name,
- labelClass: workspace.value?.id === worksp?.id ? 'font-medium text-primary-700' : '',
- onSelect: () => switchWorkspace(worksp),
- workspace: worksp // Add workspace data for the slot
- }))
- items.push(workspaceItems)
- }
-
- // Create workspace action
- items.push([
- {
- label: 'Create Workspace',
- icon: 'i-heroicons-plus',
- onSelect: createNewWorkspace
- }
- ])
-
- return items
-})
</script>
<style></style>
diff --git a/client/components/open/integrations/components/IntegrationWrapper.vue b/client/components/open/integrations/components/IntegrationWrapper.vue
index 6aade4b36..f60b461eb 100644
--- a/client/components/open/integrations/components/IntegrationWrapper.vue
+++ b/client/components/open/integrations/components/IntegrationWrapper.vue
@@ -16,7 +16,7 @@
<slot />
<slot name="logic">
- <div class="-mx-6 px-6 border-t mt-6 pt-6">
+ <div class="border-t mt-6 pt-6">
<collapse
v-model="showLogic"
class="w-full"
diff --git a/client/components/open/tables/components/TableColumnManager.vue b/client/components/open/tables/components/TableColumnManager.vue
index 4ea14f94a..bf3846818 100644
--- a/client/components/open/tables/components/TableColumnManager.vue
+++ b/client/components/open/tables/components/TableColumnManager.vue
@@ -33,19 +33,7 @@
</div>
<!-- Column Sections -->
- <div class="relative mt-1">
- <!-- Top Fade -->
- <VTransition name="fade">
- <div
- v-if="showTopFade"
- class="absolute top-0 left-0 right-0 z-10 h-8 bg-gradient-to-b from-white to-transparent pointer-events-none"
- />
- </VTransition>
-
- <div
- ref="sectionsContainer"
- class="max-h-80 overflow-y-auto"
- >
+ <ScrollableContainer class="mt-1">
<template v-for="section in columnSections" :key="section.type">
<div
v-if="section.columns.length > 0"
@@ -143,16 +131,7 @@
</draggable>
</div>
</template>
- </div>
-
- <!-- Bottom Fade -->
- <VTransition name="fade">
- <div
- v-if="showBottomFade"
- class="absolute bottom-0 left-0 right-0 z-10 h-8 bg-gradient-to-t from-white to-transparent pointer-events-none"
- />
- </VTransition>
- </div>
+ </ScrollableContainer>
<div class="w-full h-1"></div>
</div>
</template>
@@ -163,8 +142,7 @@
<script setup>
import draggable from 'vuedraggable'
import BlockTypeIcon from '~/components/open/forms/components/BlockTypeIcon.vue'
-import VTransition from '@/components/global/transitions/VTransition.vue'
-import { useScroll, useResizeObserver } from '@vueuse/core'
+import ScrollableContainer from '~/components/dashboard/ScrollableContainer.vue'
const props = defineProps({
tableState: {
@@ -185,26 +163,6 @@ const props = defineProps({
const isPopoverOpen = ref(false)
const searchQuery = ref('')
-// Scroll fade detection for sections container
-const sectionsContainer = ref(null)
-const { y: scrollY } = useScroll(sectionsContainer)
-const contentHeight = ref(0)
-const containerHeight = ref(0)
-
-const showTopFade = computed(() => scrollY.value > 0)
-const showBottomFade = computed(() => {
- if (containerHeight.value === 0 || contentHeight.value === 0) return false
- return scrollY.value < contentHeight.value - containerHeight.value - 1 // -1 for subpixel precision
-})
-
-useResizeObserver(sectionsContainer, (entries) => {
- const entry = entries[0]
- containerHeight.value = entry.contentRect.height
- if (sectionsContainer.value) {
- contentHeight.value = sectionsContainer.value.scrollHeight
- }
-})
-
// Computed maps for better performance - avoid repeated function calls in templates
const columnVisibilityMap = computed(() => {
const map = {}
diff --git a/client/components/workspaces/settings/Information.vue b/client/components/workspaces/settings/Information.vue
index 40330c97c..1e9bac711 100644
--- a/client/components/workspaces/settings/Information.vue
+++ b/client/components/workspaces/settings/Information.vue
@@ -89,7 +89,7 @@ const router = useRouter()
const { current: workspace } = useCurrentWorkspace()
-const updateMutation = update()
+const updateMutation = update(workspace.value.id)
const removeMutation = remove()
const leaveMutation = leave()
@@ -101,9 +101,7 @@ const workspaceForm = useForm({
// Update profile
const updateProfile = () => {
- workspaceForm.mutate(updateMutation, {
- data: { id: workspace.value.id }
- }).then(() => {
+ workspaceForm.mutate(updateMutation).then(() => {
useAlert().success('Workspace information successfully updated!')
}).catch((error) => {
console.error('Error updating workspace:', error)
diff --git a/client/composables/query/useWorkspaces.js b/client/composables/query/useWorkspaces.js
index ff3bb58f8..363cbdda0 100644
--- a/client/composables/query/useWorkspaces.js
+++ b/client/composables/query/useWorkspaces.js
@@ -32,11 +32,11 @@ export function useWorkspaces() {
})
}
- const detail = (id, options = {}) => {
+ const detail = (workspaceId, options = {}) => {
return useQuery({
- queryKey: ['workspaces', id],
- queryFn: () => opnFetch(`/open/workspaces/${id}`),
- enabled: !!id,
+ queryKey: ['workspaces', workspaceId],
+ queryFn: () => workspaceApi.get(toValue(workspaceId)),
+ enabled: computed(() => !!toValue(workspaceId)),
...options
})
}
@@ -61,13 +61,11 @@ export function useWorkspaces() {
})
}
- const update = (options = {}) => {
+ const update = (workspaceId, options = {}) => {
return useMutation({
- mutationFn: ({ id, data }) => opnFetch(`/open/workspaces/${id}`, {
- method: 'PUT',
- body: data
- }),
- onSuccess: (response, { id }) => {
+ mutationFn: (data) => workspaceApi.update(toValue(workspaceId), data),
+ onSuccess: (response) => {
+ const id = toValue(workspaceId)
const updatedWorkspace = response.workspace
// Update individual item cache
queryClient.setQueryData(['workspaces', id], response)
diff --git a/client/middleware/moderator.js b/client/middleware/moderator.js
index d54597754..7a3cc1d38 100644
--- a/client/middleware/moderator.js
+++ b/client/middleware/moderator.js
@@ -4,6 +4,6 @@ export default defineNuxtRouteMiddleware(() => {
const { data: userData } = user()
if (isAuthenticated.value && !userData.value?.moderator) {
- throw createError({ statusCode: 403, statusMessage: 'Forbidden' })
+ throw createError({ statusCode: 404, statusMessage: 'Not found' })
}
})