Skip to content

Commit b735fc2

Browse files
committed
clean
1 parent 164cf31 commit b735fc2

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

src/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface VuexModuleOptions {
1313
enableLocalWatchers ?:boolean | string;
1414
enableLocalSubscriptions ?:boolean | string;
1515
enableLocalActionSubscriptions ?:boolean | string;
16+
enableAutomaticGettersAndSetters ?:boolean;
1617
}
1718

1819
export interface VuexModuleAddons {

src/module.legacy.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export class LegacyVuexModule {
4646

4747
const vxmodule = extractVuexModule( VuexClass );
4848
const path = getClassPath( VuexClass.prototype.__namespacedPath__ ) || toCamelCase( VuexClass.name );
49-
console.log( "Module", vxmodule, "Path", path );
5049
return vxmodule[ path ];
5150
}
5251

src/module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export function extractVuexModule( cls :typeof VuexModule ) {
6464
modules: fromInstance.submodules,
6565
};
6666

67-
6867
// Cache the vuex module on the class.
6968
const path = getNamespacedPath( VuexClass ) || toCamelCase( VuexClass.name );
7069

src/proxy.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ export function _createProxy<T>(cls: T, $store: any, namespacedPath = "") {
121121
const classPath = getClassPath( VuexClass.prototype.__namespacedPath__ ) || toCamelCase( VuexClass.name );
122122
const { state, mutations, actions, getters, modules } = extractVuexModule( VuexClass )[ classPath ];
123123

124-
createGettersAndMutationProxyFromState({ cls: VuexClass, proxy, state, $store, namespacedPath, maxDepth: 7 });
125-
createExplicitMutationsProxy( VuexClass, proxy, $store, namespacedPath );
124+
createGettersAndMutationProxyFromState({ cls: VuexClass, proxy, state, $store, namespacedPath, maxDepth: 1 });
126125
createGettersAndGetterMutationsProxy({ cls: VuexClass, mutations, getters, proxy, $store, namespacedPath });
126+
createExplicitMutationsProxy( VuexClass, proxy, $store, namespacedPath );
127127
createActionProxy({ cls: VuexClass, actions, proxy, $store, namespacedPath });
128128
createSubModuleProxy( $store, VuexClass, proxy, modules );
129129

@@ -298,7 +298,7 @@ function createGettersAndMutationProxyFromState({ cls, proxy, state, $store, nam
298298
if (currentField.length && !currentField.endsWith(".")) currentField += ".";
299299
const path = currentField + field;
300300

301-
if ( maxDepth === 0 || typeof value !== "object") {
301+
if ( typeof value !== "object") {
302302
Object.defineProperty(proxy, field, {
303303
get: () => {
304304
// When creating local proxies getters doesn't exist on that context, so we have to account
@@ -341,7 +341,9 @@ function createExplicitMutationsProxy( cls :VuexModuleConstructor, proxy :Map, $
341341

342342
const mutations = cls.prototype.__mutations_cache__.__explicit_mutations__;
343343
const commit = cls.prototype.__store_cache__ ? cls.prototype.__store_cache__.commit : $store.commit;
344-
namespacedPath = cls.prototype.__namespacedPath__.length ? cls.prototype.__namespacedPath__ + "/" : namespacedPath;
344+
namespacedPath = refineNamespacedPath(
345+
cls.prototype.__namespacedPath__.length ? cls.prototype.__namespacedPath__ + "/" : namespacedPath
346+
);
345347

346348
for( let field in mutations ) {
347349
proxy[ field ] = ( payload :any ) => commit( namespacedPath + field, payload )
@@ -359,6 +361,8 @@ function createGettersAndGetterMutationsProxy({ cls, getters, mutations, proxy,
359361
$store.__internal_mutator__ = mutations.__internal_mutator__;
360362
}
361363

364+
namespacedPath = refineNamespacedPath( namespacedPath );
365+
362366
for( let field in getters ) {
363367

364368
if( $store === undefined ) continue;

src/utils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export function getClassPath( path :string ) {
99

1010
export function refineNamespacedPath( path :string ) {
1111
const rtn = path.split( "/" ).filter( str => str.trim().length > 0 ).join( "/" ).trim();
12-
console.log( "Return", rtn );
1312
if( rtn.length > 0 ) return rtn + "/"
1413
else return rtn;
1514
}

test-ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 5343f33db3f06798e3bbf6a817e74193422cfa8d
1+
Subproject commit 109a8706de1cbebca76b024a1c6a614c686cd22d

0 commit comments

Comments
 (0)