Skip to content

Commit 7eb9ba3

Browse files
CopilotPhantomDave
andcommitted
Replace .watch() with .fetch() for one-time GraphQL queries
Changed getAccountByEmail, loginAccount, and getAllAccounts methods to use .fetch() instead of .watch().valueChanges for better performance as these are one-time data fetches, not subscriptions that need to watch for updates. Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
1 parent bade821 commit 7eb9ba3

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

frontend/src/models/account/account-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class AccountService {
3737

3838
try {
3939
const result = await firstValueFrom(
40-
this.getAccountByEmailGQL.watch({ variables: { email } }).valueChanges
40+
this.getAccountByEmailGQL.fetch({ variables: { email } })
4141
);
4242

4343
if (result?.data?.accountByEmail !== null && result?.data?.accountByEmail !== undefined) {
@@ -99,7 +99,7 @@ export class AccountService {
9999

100100
try {
101101
const result = await firstValueFrom(
102-
this.loginAccountGQL.watch({ variables: { email, password } }).valueChanges
102+
this.loginAccountGQL.fetch({ variables: { email, password } })
103103
);
104104

105105
if (result?.data?.loginAccount) {
@@ -132,7 +132,7 @@ export class AccountService {
132132

133133
try {
134134
const result = await firstValueFrom(
135-
this.getAccountsGQL.watch().valueChanges
135+
this.getAccountsGQL.fetch({})
136136
);
137137

138138
if (result?.data?.accounts) {

0 commit comments

Comments
 (0)