Skip to content
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

Legacy warnings 3.x #5474

Merged
merged 10 commits into from
Feb 5, 2019
Merged
8 changes: 6 additions & 2 deletions lib/mixins/element-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,12 @@ export const ElementMixin = dedupingMixin(base => {
// setup where multiple triggers for setting a property)
// While we do have `hasComputedEffect` this is set on the property's
// dependencies rather than itself.
if (info.computed && !proto._hasReadOnlyEffect(name)) {
proto._createComputedProperty(name, info.computed, allProps);
if (info.computed) {
if (proto._hasReadOnlyEffect(name)) {
console.warn(`Cannot redefine computed property '${name}'.`);
} else {
proto._createComputedProperty(name, info.computed, allProps);
}
}
if (info.readOnly && !proto._hasReadOnlyEffect(name)) {
proto._createReadOnlyProperty(name, !info.computed);
Expand Down
5 changes: 4 additions & 1 deletion lib/mixins/property-effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { camelToDashCase, dashToCamelCase } from '../utils/case-map.js';
import { PropertyAccessors } from './property-accessors.js';
/* for annotated effects */
import { TemplateStamp } from './template-stamp.js';
import { sanitizeDOMValue } from '../utils/settings.js';
import { sanitizeDOMValue, legacyOptimizations } from '../utils/settings.js';

// Monotonically increasing unique ID used for de-duping effects triggered
// from multiple properties in the same turn
Expand Down Expand Up @@ -2390,6 +2390,9 @@ export const PropertyEffects = dedupingMixin(superClass => {
* @protected
*/
static _addTemplatePropertyEffect(templateInfo, prop, effect) {
if (legacyOptimizations && !(prop in templateInfo.dynamicFns)) {
kevinpschaaf marked this conversation as resolved.
Show resolved Hide resolved
console.warn(`Property '${prop}' used in template but not declared in 'properties'.`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.warn(`Property '${prop}' used in template but not declared in 'properties'.`);
console.warn(`Property '${prop}' used in template but not declared in 'properties'. Setting an attribute will not set the corresponding property unless the property is declared in 'properties'.`;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
let hostProps = templateInfo.hostProps = templateInfo.hostProps || {};
hostProps[prop] = true;
let effects = templateInfo.propertyEffects = templateInfo.propertyEffects || {};
Expand Down
Loading