Skip to content

Open source personal finance application

fix(ui): force single reka-ui chunk to prevent duplicated context symbols

Ilya Komichev812cfbffb57f
diff --git a/app/app/components/ui/ContextMenuMy.vue b/app/app/components/ui/ContextMenuMy.vue
index afc6fbcc..e429906f 100644
--- a/app/app/components/ui/ContextMenuMy.vue
+++ b/app/app/components/ui/ContextMenuMy.vue
@@ -30,10 +30,10 @@ const emit = defineEmits<{
'update:open': [open: boolean]
}>()
-const exposer = ref<{ close: () => void } | null>(null)
+const open = ref(false)
function close() {
- exposer.value?.close()
+ open.value = false
}
onMounted(() => {
@@ -42,6 +42,7 @@ onMounted(() => {
})
function onOpen(v: boolean) {
+ open.value = v
emit('update:open', v)
if (v) {
closeOtherContextMenus(close)
@@ -61,11 +62,11 @@ const ui = computed(() => tv({
<template>
<ContextMenuRoot
+ :open="open"
:modal="props.modal"
:pressOpenDelay="props.pressOpenDelay"
@update:open="onOpen"
>
- <UiContextMenuStateExposer ref="exposer" />
<ContextMenuTrigger asChild :disabled="props.disabled">
<slot />
</ContextMenuTrigger>
diff --git a/app/app/components/ui/ContextMenuStateExposer.vue b/app/app/components/ui/ContextMenuStateExposer.vue
deleted file mode 100644
index 3fa158ae..00000000
--- a/app/app/components/ui/ContextMenuStateExposer.vue
+++ /dev/null
@@ -1,13 +0,0 @@
-<script setup lang="ts">
-import { injectContextMenuRootContext } from 'reka-ui'
-
-const ctx = injectContextMenuRootContext()
-
-defineExpose({
- close: () => ctx.onOpenChange(false),
-})
-</script>
-
-<template>
- <div hidden />
-</template>
diff --git a/app/nuxt.config.ts b/app/nuxt.config.ts
index 537cbfc6..515f22b7 100644
--- a/app/nuxt.config.ts
+++ b/app/nuxt.config.ts
@@ -212,6 +212,21 @@ export default defineNuxtConfig({
telemetry: false,
vite: {
+ build: {
+ rollupOptions: {
+ output: {
+ // Force all reka-ui code into a single chunk so its internal
+ // createContext('ContextMenuRoot') etc. resolve to one Symbol
+ // across provider/inject. Otherwise @nuxt/ui's mixed imports
+ // ("reka-ui" vs "reka-ui/namespaced") let Rollup emit the
+ // underlying module twice, breaking inject in production.
+ manualChunks(id) {
+ if (id.includes('node_modules/reka-ui') || /reka-ui@[^/]+/.test(id))
+ return 'reka-ui'
+ },
+ },
+ },
+ },
optimizeDeps: {
include: [
'localforage',
@@ -224,6 +239,8 @@ export default defineNuxtConfig({
'convex/server',
'@internationalized/date',
'date-fns/locale',
+ 'reka-ui',
+ 'reka-ui/namespaced',
],
},
},
diff --git a/app/package.json b/app/package.json
index 587b839e..753b1fa9 100644
--- a/app/package.json
+++ b/app/package.json
@@ -1,7 +1,7 @@
{
"name": "@finapp/app",
"type": "module",
- "version": "7.12.0",
+ "version": "7.12.2",
"private": true,
"description": "Finapp helps you easily track and manage personal finances.",
"author": "Ilya Komichev @ilkome",
diff --git a/package.json b/package.json
index 750af50d..4aba98be 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "finapp",
"type": "module",
- "version": "7.12.0",
+ "version": "7.12.2",
"private": true,
"packageManager": "[email protected]",
"description": "Finapp helps you easily track and manage personal finances",
@@ -51,15 +51,5 @@
"prettier-plugin-tailwindcss": "^0.7.2",
"tailwindcss": "^4.2.2",
"typescript": "^6.0.2"
- },
- "pnpm": {
- "overrides": {
- "fast-uri@<=3.1.0": ">=3.1.1",
- "fast-uri@<=3.1.1": ">=3.1.2",
- "hono@<4.12.18": ">=4.12.18",
- "ip-address@<=10.1.0": ">=10.1.1",
- "serialize-javascript@<7.0.5": ">=7.0.5",
- "serialize-javascript@<=7.0.2": ">=7.0.3"
- }
}
}
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index ae5e46bd..4dc8e0c6 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -1,3 +1,10 @@
packages:
- app
- docs
+overrides:
+ fast-uri@<=3.1.0: '>=3.1.1'
+ fast-uri@<=3.1.1: '>=3.1.2'
+ hono@<4.12.18: '>=4.12.18'
+ ip-address@<=10.1.0: '>=10.1.1'
+ serialize-javascript@<=7.0.2: '>=7.0.3'
+ serialize-javascript@<7.0.5: '>=7.0.5'