Skip to content

Commit 5e1c393

Browse files
committed
Remove pinia
1 parent 78f9a58 commit 5e1c393

File tree

5 files changed

+6
-38
lines changed

5 files changed

+6
-38
lines changed

Diff for: package.json

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"overlayscrollbars": "^2.5.0",
2424
"overlayscrollbars-vue": "^0.5.7",
2525
"p-all": "^5.0.0",
26-
"pinia": "^2.1.7",
2726
"redaxios": "^0.5.1",
2827
"tauri-plugin-autostart-api": "github:tauri-apps/tauri-plugin-autostart",
2928
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",

Diff for: pnpm-lock.yaml

-25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: src/composables/useRoute.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { readonly, ref, shallowRef } from 'vue'
2-
import { defineStore } from 'pinia'
32
import type { Option } from '../types'
43
import { singleton } from '../utils/common'
54

Diff for: src/main.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'focus-visible'
44
import 'overlayscrollbars/overlayscrollbars.css'
55

66
import { createApp } from 'vue'
7-
import { createPinia } from 'pinia'
87
import { isEnabled as isAutostartEnabled } from 'tauri-plugin-autostart-api'
98
import dayjs from 'dayjs'
109
import relativeTime from 'dayjs/plugin/relativeTime'
@@ -34,12 +33,9 @@ async function main() {
3433
window.addEventListener('contextmenu', e => e.preventDefault())
3534

3635
const app = createApp(App)
37-
const pinia = createPinia()
38-
39-
app.use(pinia)
4036

4137
await cacheStorageFromDisk()
42-
const store = useStore(pinia)
38+
const store = useStore()
4339
const route = useRoute()
4440
const token = AppStorage.get('accessToken')
4541
const user = AppStorage.get('user')

Diff for: src/stores/store.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { sendNotification } from '@tauri-apps/api/notification'
21
import { invoke } from '@tauri-apps/api/tauri'
3-
import { defineStore } from 'pinia'
4-
import { ref, watchEffect } from 'vue'
2+
import { reactive, ref, watchEffect } from 'vue'
53
import pAll from 'p-all'
64
import { type UpdateManifest, installUpdate } from '@tauri-apps/api/updater'
75
import { relaunch } from '@tauri-apps/api/process'
@@ -13,8 +11,9 @@ import type { NotificationList, Option } from '../types'
1311
import { isRepository, isThread, toNotificationList } from '../utils/notification'
1412
import { everySome } from '../utils/array'
1513
import { Page, useRoute } from '../composables/useRoute'
14+
import { singleton } from '../utils/common'
1615

17-
export const useStore = defineStore('store', () => {
16+
export const useStore = singleton(() => {
1817
const notifications = ref<NotificationList>([])
1918
const loadingNotifications = ref(false)
2019
const failedLoadingNotifications = ref(false)
@@ -222,7 +221,7 @@ export const useStore = defineStore('store', () => {
222221
.filter(thread => thread.repository.id === repository.id)
223222
}
224223

225-
return {
224+
return reactive({
226225
newRelease,
227226
notifications,
228227
loadingNotifications,
@@ -241,5 +240,5 @@ export const useStore = defineStore('store', () => {
241240
removeNotificationById,
242241
processCheckedNotifications,
243242
logout,
244-
}
243+
})
245244
})

0 commit comments

Comments
 (0)