Skip to content

Commit

Permalink
refactor(foxy-user-invitation-form): delay refresh by 1s to avoid hit…
Browse files Browse the repository at this point in the history
…ting cache
  • Loading branch information
pheekus committed Jan 17, 2025
1 parent cd37072 commit 056fd0d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ export class InternalUserInvitationFormAsyncAction extends InternalControl {
const api = new NucleonElement.API(this);
const response = await api.fetch(this.href ?? '', { method: 'POST' });

this.__state = response.ok ? 'idle' : 'fail';
if (response.ok) this.nucleon?.refresh();
if (response.ok) {
// if we refresh right away, sometimes we get an old response from cache
await new Promise<void>(resolve => setTimeout(resolve, 1000));
this.nucleon?.refresh();
this.__state = 'idle';
} else {
this.__state = 'fail';
}
} catch {
this.__state = 'fail';
}
Expand Down

0 comments on commit 056fd0d

Please sign in to comment.