Skip to content

Commit

Permalink
no saving on form init
Browse files Browse the repository at this point in the history
  • Loading branch information
lukavdplas committed Aug 30, 2024
1 parent 1ac11c3 commit 023ed2e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SourceMention,
UpdateAgentInput,
} from 'generated/graphql';
import { Observable, map, switchMap, shareReplay, filter, debounceTime, distinctUntilChanged, withLatestFrom, BehaviorSubject, tap } from 'rxjs';
import { Observable, map, switchMap, shareReplay, filter, debounceTime, distinctUntilChanged, withLatestFrom, BehaviorSubject, tap, skip } from 'rxjs';
import _ from 'underscore';
import { FormService } from '../../shared/form.service';
import { FormStatus } from '../../shared/types';
Expand Down Expand Up @@ -100,6 +100,7 @@ export class AgentDescriptionFormComponent implements OnDestroy {
this.form.valueChanges.pipe(
debounceTime(500),
distinctUntilChanged(_.isEqual),
skip(1),
filter(this.isValid.bind(this)),
tap(() => this.status$.next('loading')),
withLatestFrom(this.id$),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
distinctUntilChanged,

tap,
BehaviorSubject
BehaviorSubject,
skip
} from 'rxjs';
import _ from 'underscore';
import { FormService } from '../../shared/form.service';
Expand Down Expand Up @@ -61,6 +62,7 @@ export class AgentIdentificationFormComponent implements OnDestroy {
const changes$ = this.form.valueChanges.pipe(
debounceTime(500),
distinctUntilChanged(_.isEqual),
skip(1),
);

changes$.pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class FormStatusComponent {
statusIcons = statusIcons;

messages: Record<FormStatus, string> = {
'idle': 'Waiting for input',
'idle': 'No changes made',
'invalid': 'Form contains errors',
'loading': 'Loading...',
'saved': 'Changes saved',
Expand Down

0 comments on commit 023ed2e

Please sign in to comment.