File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
66and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 1.5.1] - 2021-08-04
9+ ### Fixed
10+ - Optimise serialization code
11+
812## [ 1.5.0] - 2021-08-03
913### Added
1014- Support for serialized payloads - #125 / @Heziode
Original file line number Diff line number Diff line change 11{
22 "name" : " vuex-pathify" ,
3- "version" : " 1.5.0 " ,
3+ "version" : " 1.5.1 " ,
44 "description" : " Ridiculously simple Vuex setup + wiring" ,
55 "main" : " dist/vuex-pathify.js" ,
66 "module" : " dist/vuex-pathify.esm.js" ,
Original file line number Diff line number Diff line change 1- import { isObject , setValue } from '../utils/object'
1+ import { isPlainObject , setValue } from '../utils/object'
22import options from '../plugin/options'
33
44/**
@@ -44,5 +44,8 @@ export default class Payload {
4444 * @see https://github.com/davestewart/vuex-pathify/pull/125
4545 */
4646Payload . isSerialized = function ( value ) {
47- return isObject ( value ) && 'expr' in value && 'path' in value && 'value' in value
47+ return isPlainObject ( value )
48+ && 'expr' in value
49+ && 'path' in value
50+ && 'value' in value
4851}
Original file line number Diff line number Diff line change @@ -40,12 +40,13 @@ export function makeMutations (state) {
4040 . reduce ( function ( obj , key ) {
4141 const mutation = resolveName ( 'mutations' , key )
4242 obj [ mutation ] = function ( state , value ) {
43- if ( Payload . isSerialized ( value ) ) {
44- value = new Payload ( value . expr , value . path , value . value )
43+ if ( value instanceof Payload ) {
44+ value = value . update ( state [ key ] )
4545 }
46- state [ key ] = value instanceof Payload
47- ? value . update ( state [ key ] )
48- : value
46+ else if ( Payload . isSerialized ( value ) ) {
47+ value = Payload . prototype . update . call ( value , state [ key ] )
48+ }
49+ state [ key ] = value
4950 }
5051 return obj
5152 } , { } )
You can’t perform that action at this time.
0 commit comments