0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00

Only clear mapped properties if the field id remains the same

Dieser Commit ist enthalten in:
Angus McLeod 2020-04-14 16:06:02 +10:00
Ursprung d128565979
Commit 303c79be1f

Datei anzeigen

@ -19,11 +19,21 @@ export default Component.extend({
showMinLength: or('isText', 'isTextarea', 'isUrl', 'isComposer'),
categoryPropertyTypes: selectKitContent(['id', 'slug']),
@observes('field.type')
clearMapped() {
// clearMapped only clears mapped fields if the field type of a specific field
// changes, and not when switching between fields. Switching between fields also
// changes the field.type property in this component
@observes('field.id', 'field.type')
clearMapped(ctx, changed) {
if (this.field.id === this.bufferedFieldId) {
schema.field.mapped.forEach(property => {
this.set(`field.${property}`, null);
});
}
if (changed === 'field.type') {
this.set('bufferedFieldId', this.field.id);
}
},
setupTypeOutput(fieldType, options) {