Skip to content

Commit

Permalink
Merged in bugfix/SHIBUI-1233 (pull request #300)
Browse files Browse the repository at this point in the history
SHIBUI-1233 Fix for issue with saving between editing tabs

Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
rmathis committed Feb 15, 2019
2 parents 70813f7 + bd9860c commit 60ee626
Showing 1 changed file with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { MetadataResolver } from '../../domain/model';
import { LockEditor, UnlockEditor } from '../../../wizard/action/wizard.action';

import * as fromWizard from '../../../wizard/reducer';
import { withLatestFrom, map, distinctUntilChanged, filter } from 'rxjs/operators';
import { withLatestFrom, map, distinctUntilChanged, filter, takeUntil } from 'rxjs/operators';
import { UpdateChanges } from '../action/entity.action';
import { FormControl } from '@angular/forms';

Expand Down Expand Up @@ -81,25 +81,30 @@ export class ResolverEditStepComponent implements OnDestroy {
this.changes$,
this.definition$
),
map(([schema, resolver, model, changes, definition]) => ({
model: {
...model,
...resolver,
...changes
},
definition
})),
map(([schema, resolver, model, changes, definition]) => {
return ({
model: {
...model,
...resolver,
...changes
},
definition
});
}),
filter(({ model, definition }) => definition && model),
map(({ model, definition }) => definition.formatter(model))
);

this.valueChangeEmitted$.pipe(
takeUntil(this.ngUnsubscribe),
map(changes => changes.value),
withLatestFrom(this.definition$, this.store.select(fromResolver.getSelectedResolver)),
filter(([changes, definition]) => definition && changes),
map(([changes, definition, resolver]) => definition.parser({ ...resolver, ...changes }))
withLatestFrom(this.definition$, this.store.select(fromResolver.getSelectedResolver), this.changes$),
filter(([valueChange, definition, resolver]) => definition && resolver),
map(([valueChange, definition, resolver, changes]) => definition.parser({ ...resolver, ...changes, ...valueChange }))
)
.subscribe(changes => this.store.dispatch(new UpdateChanges(changes)));
.subscribe(changes => {
this.store.dispatch(new UpdateChanges(changes));
});

this.statusChangeEmitted$
.pipe(distinctUntilChanged())
Expand Down

0 comments on commit 60ee626

Please sign in to comment.