-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17304 from ElectronicBlueberry/scoped-store-refactor
Scoped Store Refactor and Store Composition Refactor
- Loading branch information
Showing
9 changed files
with
682 additions
and
612 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineStore } from "pinia"; | ||
|
||
import { useScopePointerStore } from "./scopePointerStore"; | ||
|
||
export function defineScopedStore<ID extends string, S>(id: ID, setup: (scopeId: string) => S) { | ||
return (scopeId: string) => { | ||
const { scope } = useScopePointerStore(); | ||
|
||
return defineStore<`${ID}-${typeof scopeId}`, S>(`${id}-${scope(scopeId)}`, () => setup(scopeId))(); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.