Skip to content

Fix null and non submodules objects properties in state #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/proxy.js

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

2 changes: 1 addition & 1 deletion dist/proxy.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion dist/submodule.js

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

2 changes: 1 addition & 1 deletion dist/submodule.js.map

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

2 changes: 1 addition & 1 deletion js/proxy.js

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

2 changes: 1 addition & 1 deletion js/proxy.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion js/submodule.js

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

2 changes: 1 addition & 1 deletion js/submodule.js.map

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

2 changes: 1 addition & 1 deletion src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function createGettersAndMutationProxyFromState({ cls, proxy, state, $store, nam
if (currentField.length && !currentField.endsWith(".")) currentField += ".";
const path = currentField + field;

if ( maxDepth === 0 || typeof value !== "object" ) {
if ( maxDepth === 0 || typeof value !== "object" || (typeof value === 'object' && !fieldIsSubmodule) ) {

if( !strict || fieldIsSubmodule ) {

Expand Down
3 changes: 2 additions & 1 deletion src/submodule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { extractVuexModule } from "./module";
import { toCamelCase, getClassPath } from "./utils"

export function isFieldASubModule( instance :VuexModule & Map, field :string ) {
return(
return(
instance[ field ] != null &&
typeof instance[ field ] === "object" &&
instance[ field ][ "__submodule_type__" ] === "submodule"
)
Expand Down