From e81ab0a5ea37b248e2a65215e2b6025c00a15f25 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 7 Aug 2026 14:38:31 +0200 Subject: [PATCH] refactor: prepare vue components for vapor mode (#38798) Removes what would block a later switch to Vue's vapor mode: `vue-chartjs` and the `SvgIcon` render function are virtual DOM components, and `v-memo` has no vapor equivalent. This does not adopt vapor mode, which will be stable in upcoming Vue 3.6. `vue-chartjs` was a thin wrapper over chart.js, so a local `ChartCanvas.vue` replaces it. Chart data and options move into computed values to keep their object identity, which is what `v-memo` was compensating for. `chartjs-adapter-dayjs-4` is moved first-party, just ~40 lines that are easy to maintain. --- package.json | 4 +- pnpm-lock.yaml | 29 -------- web_src/js/components/ActionRunJobView.vue | 2 +- web_src/js/components/ActionStatusIcon.vue | 2 +- web_src/js/components/ChartCanvas.vue | 71 +++++++++++++++++++ web_src/js/components/ContextPopup.vue | 2 +- web_src/js/components/DashboardRepoList.vue | 2 +- web_src/js/components/DiffCommitSelector.vue | 2 +- web_src/js/components/DiffFileTreeItem.vue | 3 +- .../js/components/PullRequestMergeForm.vue | 2 +- web_src/js/components/RepoActionView.vue | 2 +- .../js/components/RepoBranchTagSelector.vue | 2 +- web_src/js/components/RepoCodeFrequency.vue | 24 +++---- web_src/js/components/RepoContributors.vue | 49 +++++++------ web_src/js/components/RepoFileSearch.vue | 2 +- web_src/js/components/RepoRecentCommits.vue | 24 +++---- web_src/js/components/SvgIcon.test.ts | 10 +++ web_src/js/components/SvgIcon.vue | 37 ++++++++++ web_src/js/components/ViewFileTreeItem.vue | 2 +- web_src/js/components/WorkflowGraph.vue | 2 +- web_src/js/svg.test.ts | 14 +--- web_src/js/svg.ts | 36 +--------- 22 files changed, 178 insertions(+), 145 deletions(-) create mode 100644 web_src/js/components/ChartCanvas.vue create mode 100644 web_src/js/components/SvgIcon.test.ts create mode 100644 web_src/js/components/SvgIcon.vue diff --git a/package.json b/package.json index 231ea7adfe7..69342bdb0f2 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@vitejs/plugin-vue": "6.0.8", "asciinema-player": "3.17.0", "chart.js": "4.5.1", - "chartjs-adapter-dayjs-4": "1.0.4", "chartjs-plugin-zoom": "2.2.0", "clippie": "4.2.1", "codemirror-lang-elixir": "4.0.1", @@ -66,8 +65,7 @@ "vanilla-colorful": "0.7.2", "vite": "8.1.5", "vite-string-plugin": "2.0.5", - "vue": "3.5.40", - "vue-chartjs": "5.3.4" + "vue": "3.5.40" }, "devDependencies": { "@eslint-community/eslint-plugin-eslint-comments": "4.7.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cbe15f31cfc..cf171d3e0db 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -101,9 +101,6 @@ importers: chart.js: specifier: 4.5.1 version: 4.5.1 - chartjs-adapter-dayjs-4: - specifier: 1.0.4 - version: 1.0.4(chart.js@4.5.1)(dayjs@1.11.21) chartjs-plugin-zoom: specifier: 2.2.0 version: 2.2.0(chart.js@4.5.1) @@ -191,9 +188,6 @@ importers: vue: specifier: 3.5.40 version: 3.5.40(typescript@6.0.3) - vue-chartjs: - specifier: 5.3.4 - version: 5.3.4(chart.js@4.5.1)(vue@3.5.40(typescript@6.0.3)) devDependencies: '@eslint-community/eslint-plugin-eslint-comments': specifier: 4.7.2 @@ -1834,13 +1828,6 @@ packages: resolution: {integrity: sha512-GIjfiT9dbmHRiYi6Nl2yFCq7kkwdkp1W/lp2J99rX0yo9tgJGn3lKQATztIjb5tVtevcBtIdICNWqlq5+E8/Pw==} engines: {pnpm: '>=8'} - chartjs-adapter-dayjs-4@1.0.4: - resolution: {integrity: sha512-yy9BAYW4aNzPVrCWZetbILegTRb7HokhgospPoC3b5iZ5qdlqNmXts2KdSp6AqnjkPAp/YWyHDxLvIvwt5x81w==} - engines: {node: '>=10'} - peerDependencies: - chart.js: '>=4.0.1' - dayjs: ^1.9.7 - chartjs-plugin-zoom@2.2.0: resolution: {integrity: sha512-in6kcdiTlP6npIVLMd4zXZ08PDUXC52gZ4FAy5oyjk1zX3gKarXMAof7B9eFiisf9WOC3bh2saHg+J5WtLXZeA==} peerDependencies: @@ -4303,12 +4290,6 @@ packages: vscode-uri@3.1.0: resolution: {integrity: sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==} - vue-chartjs@5.3.4: - resolution: {integrity: sha512-x3Fqob8RQvrTdssfi9ecsCzEkFOd8JPmNwSkSQzdfKj/uBsRJs/Y88cZcZIEcPsTVfMGwMo4MOoihoDG2DoE/g==} - peerDependencies: - chart.js: ^4.1.1 - vue: ^3.0.0-0 || ^2.7.0 - vue-eslint-parser@10.4.0: resolution: {integrity: sha512-Vxi9pJdbN3ZnVGLODVtZ7y4Y2kzAAE2Cm0CZ3ZDRvydVYxZ6VrnBhLikBsRS+dpwj4Jv4UCv21PTEwF5rQ9WXg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -6125,11 +6106,6 @@ snapshots: dependencies: '@kurkle/color': 0.3.4 - chartjs-adapter-dayjs-4@1.0.4(chart.js@4.5.1)(dayjs@1.11.21): - dependencies: - chart.js: 4.5.1 - dayjs: 1.11.21 - chartjs-plugin-zoom@2.2.0(chart.js@4.5.1): dependencies: '@types/hammerjs': 2.0.46 @@ -8999,11 +8975,6 @@ snapshots: vscode-uri@3.1.0: {} - vue-chartjs@5.3.4(chart.js@4.5.1)(vue@3.5.40(typescript@6.0.3)): - dependencies: - chart.js: 4.5.1 - vue: 3.5.40(typescript@6.0.3) - vue-eslint-parser@10.4.0(eslint@10.8.0(jiti@2.7.0)(supports-color@10.2.2))(supports-color@10.2.2): dependencies: debug: 4.4.3(supports-color@10.2.2) diff --git a/web_src/js/components/ActionRunJobView.vue b/web_src/js/components/ActionRunJobView.vue index 168569c1829..ac06e6ab88a 100644 --- a/web_src/js/components/ActionRunJobView.vue +++ b/web_src/js/components/ActionRunJobView.vue @@ -1,6 +1,6 @@ + + diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 38e83d2c1f7..f2ba9985b01 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -1,5 +1,5 @@