44 * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
55 */
66import { dedupeMixin } from '@open-wc/dedupe-mixin' ;
7+ import { notEqual } from 'lit' ;
78import { get , set } from './path-utils.js' ;
89
910const caseMap = { } ;
@@ -101,12 +102,15 @@ const PolylitMixinImplementation = (superclass) => {
101102 get : defaultDescriptor . get ,
102103 set ( value ) {
103104 const oldValue = this [ name ] ;
104- this [ key ] = value ;
105- this . requestUpdate ( name , oldValue , options ) ;
106105
107- // Enforce synchronous update
108- if ( this . hasUpdated ) {
109- this . performUpdate ( ) ;
106+ if ( notEqual ( value , oldValue ) ) {
107+ this [ key ] = value ;
108+ this . requestUpdate ( name , oldValue , options ) ;
109+
110+ // Enforce synchronous update
111+ if ( this . hasUpdated ) {
112+ this . performUpdate ( ) ;
113+ }
110114 }
111115 } ,
112116 configurable : true ,
@@ -115,21 +119,17 @@ const PolylitMixinImplementation = (superclass) => {
115119 }
116120
117121 if ( options . readOnly ) {
118- const setter = defaultDescriptor . set ;
122+ const setter = result . set ;
119123
120124 this . addCheckedInitializer ( ( instance ) => {
121125 // This is run during construction of the element
122126 instance [ `_set${ upper ( name ) } ` ] = function ( value ) {
123127 setter . call ( instance , value ) ;
124-
125- if ( options . sync ) {
126- this . performUpdate ( ) ;
127- }
128128 } ;
129129 } ) ;
130130
131131 result = {
132- get : defaultDescriptor . get ,
132+ get : result . get ,
133133 set ( ) {
134134 // Do nothing, property is read-only.
135135 } ,
0 commit comments