]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
feat: remove deprecated APIs
authorEduardo San Martin Morote <posva13@gmail.com>
Thu, 3 Jun 2021 12:43:17 +0000 (14:43 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Thu, 3 Jun 2021 12:43:17 +0000 (14:43 +0200)
__tests__/subscriptions.spec.ts
docs/core-concepts/index.md
docs/core-concepts/state.md
src/deprecated.ts [deleted file]
src/index.ts
src/store.ts
src/types.ts
test-dts/deprecated.test-d.ts [deleted file]

index b07aefc378c75e672be47e8050504f84e93f991f..61a91402381ebb3d4ed4c8ff673929b5244a7f27 100644 (file)
@@ -25,7 +25,6 @@ describe('Subscriptions', () => {
     expect(spy).toHaveBeenCalledTimes(1)
     expect(spy).toHaveBeenCalledWith(
       expect.objectContaining({
-        storeName: 'main',
         storeId: 'main',
         type: MutationType.direct,
       }),
@@ -44,7 +43,6 @@ describe('Subscriptions', () => {
     expect(spy).toHaveBeenCalledWith(
       expect.objectContaining({
         payload: patch,
-        storeName: 'main',
         storeId: 'main',
         type: MutationType.patchObject,
       }),
index 17b67b41c02ea035b5884d0bd4b0664c92bc2d6f..fe0c295c4e7f5af9e6096aeaadb63290d93e37ef 100644 (file)
@@ -8,7 +8,7 @@ import { defineStore } from 'pinia'
 // useStore could be anything like useUser, useCart
 export const useStore = defineStore({
   // unique id of the store across your application
-  id: 'storeName',
+  id: 'storeId',
 })
 ```
 
index 48a7bedc8f160398088f33314fbb3aeaca29a41e..a1af14c5bd0cd8f96ba4ad2bf356336b88caea9e 100644 (file)
@@ -6,7 +6,7 @@ The state is, most of the time, the central part of your store. People often sta
 import { defineStore } from 'pinia'
 
 const useStore = defineStore({
-  id: 'storeName',
+  id: 'storeId',
   // can also be defined with an arrow function if you prefer that syntax
   state() {
     return {
diff --git a/src/deprecated.ts b/src/deprecated.ts
deleted file mode 100644 (file)
index 1d08727..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-import { defineStore } from './store'
-
-/**
- * {@inheritDoc defineStore}
- * @deprecated Use {@link defineStore}
- */
-export const createStore = ((options: any) => {
-  console.warn(
-    '[🍍]: "createStore" has been deprecated and will be removed on the sable release, use "defineStore" instead.'
-  )
-  return defineStore(options)
-}) as typeof defineStore
index cd3aa43dda1a0a8572fb9ecb6517779efbc304b0..a3d669ab2b89c3389ea8b78ccad91cfca1e414c8 100644 (file)
@@ -49,6 +49,3 @@ export type {
   _Spread,
   _StoreObject,
 } from './mapHelpers'
-
-// TODO: remove in beta
-export { createStore } from './deprecated'
index 0ff26be7f3129a754f6f4836f1f607f0968d52dc..105d11211ca706f11cdecbe61ad4f56ccc947799 100644 (file)
@@ -137,7 +137,6 @@ function initStore<
       partialStateOrMutator(pinia.state.value[$id] as UnwrapRef<S>)
       subscriptionMutation = {
         type: MutationType.patchFunction,
-        storeName: $id,
         storeId: $id,
         events: debuggerEvents as DebuggerEvent[],
       }
@@ -146,7 +145,6 @@ function initStore<
       subscriptionMutation = {
         type: MutationType.patchObject,
         payload: partialStateOrMutator,
-        storeName: $id,
         storeId: $id,
         events: debuggerEvents as DebuggerEvent[],
       }
@@ -188,7 +186,6 @@ function initStore<
         if (isListening) {
           callback(
             {
-              storeName: $id,
               storeId: $id,
               type: MutationType.direct,
               events: debuggerEvents as DebuggerEvent,
index e409400675962e2649563c84f803d1f67da18a96..608d7180e703883b989e53ae26995ecdca203b0a 100644 (file)
@@ -70,11 +70,6 @@ export interface _SubscriptionCallbackMutationBase {
    */
   type: MutationType
 
-  /**
-   * @deprecated use `storeId` instead.
-   */
-  storeName: string
-
   /**
    * `id` of the store doing the mutation.
    */
diff --git a/test-dts/deprecated.test-d.ts b/test-dts/deprecated.test-d.ts
deleted file mode 100644 (file)
index 43e40b7..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import { createStore, expectType } from './'
-
-const useDeprecated = createStore({
-  id: 'name',
-  state: () => ({ a: 'on' as 'on' | 'off', nested: { counter: 0 } }),
-  getters: {
-    upper: (state) => state.a.toUpperCase(),
-  },
-})
-
-const deprecatedStore = useDeprecated()
-
-expectType<{ a: 'on' | 'off' }>(deprecatedStore.$state)
-expectType<number>(deprecatedStore.nested.counter)
-expectType<'on' | 'off'>(deprecatedStore.a)
-
-// @ts-expect-error
-deprecatedStore.nonExistant
-
-// @ts-expect-error
-deprecatedStore.nonExistant.stuff