Skip to content

Commit

Permalink
Remove pinia
Browse files Browse the repository at this point in the history
  • Loading branch information
kadiryazici committed Mar 19, 2024
1 parent 78f9a58 commit 5e1c393
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 38 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"overlayscrollbars": "^2.5.0",
"overlayscrollbars-vue": "^0.5.7",
"p-all": "^5.0.0",
"pinia": "^2.1.7",
"redaxios": "^0.5.1",
"tauri-plugin-autostart-api": "github:tauri-apps/tauri-plugin-autostart",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
Expand Down
25 changes: 0 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/composables/useRoute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readonly, ref, shallowRef } from 'vue'
import { defineStore } from 'pinia'
import type { Option } from '../types'
import { singleton } from '../utils/common'

Expand Down
6 changes: 1 addition & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'focus-visible'
import 'overlayscrollbars/overlayscrollbars.css'

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

const app = createApp(App)
const pinia = createPinia()

app.use(pinia)

await cacheStorageFromDisk()
const store = useStore(pinia)
const store = useStore()
const route = useRoute()
const token = AppStorage.get('accessToken')
const user = AppStorage.get('user')
Expand Down
11 changes: 5 additions & 6 deletions src/stores/store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { sendNotification } from '@tauri-apps/api/notification'
import { invoke } from '@tauri-apps/api/tauri'
import { defineStore } from 'pinia'
import { ref, watchEffect } from 'vue'
import { reactive, ref, watchEffect } from 'vue'
import pAll from 'p-all'
import { type UpdateManifest, installUpdate } from '@tauri-apps/api/updater'
import { relaunch } from '@tauri-apps/api/process'
Expand All @@ -13,8 +11,9 @@ import type { NotificationList, Option } from '../types'
import { isRepository, isThread, toNotificationList } from '../utils/notification'
import { everySome } from '../utils/array'
import { Page, useRoute } from '../composables/useRoute'
import { singleton } from '../utils/common'

export const useStore = defineStore('store', () => {
export const useStore = singleton(() => {
const notifications = ref<NotificationList>([])
const loadingNotifications = ref(false)
const failedLoadingNotifications = ref(false)
Expand Down Expand Up @@ -222,7 +221,7 @@ export const useStore = defineStore('store', () => {
.filter(thread => thread.repository.id === repository.id)
}

return {
return reactive({
newRelease,
notifications,
loadingNotifications,
Expand All @@ -241,5 +240,5 @@ export const useStore = defineStore('store', () => {
removeNotificationById,
processCheckedNotifications,
logout,
}
})
})

0 comments on commit 5e1c393

Please sign in to comment.