@go-avro/avro-js 0.0.2-beta.142 → 0.0.2-beta.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,16 +46,7 @@ AvroQueryClient.prototype.useUpdateUserCompany = function () {
46
46
  onMutate: async (data) => {
47
47
  await queryClient.cancelQueries({ queryKey: ['user'] });
48
48
  await queryClient.cancelQueries({ queryKey: ['company', this.companyId] });
49
- const previousUser = queryClient.getQueryData(['user']);
50
49
  const previousCompany = queryClient.getQueryData(['company', this.companyId]);
51
- if (previousUser) {
52
- let oldUserCompany = previousUser.companies?.find(c => c.company === this.companyId);
53
- if (oldUserCompany) {
54
- oldUserCompany = { ...oldUserCompany, ...data.data };
55
- const newCompanies = previousUser.companies?.map(c => c.company === this.companyId ? oldUserCompany : c) ?? [];
56
- queryClient.setQueryData(['user'], { ...previousUser, companies: newCompanies });
57
- }
58
- }
59
50
  if (previousCompany) {
60
51
  let oldCompanyUser = previousCompany.users?.find((u) => u.user.id === data.user_id);
61
52
  if (oldCompanyUser) {
@@ -64,14 +55,11 @@ AvroQueryClient.prototype.useUpdateUserCompany = function () {
64
55
  queryClient.setQueryData(['company', this.companyId], { ...previousCompany, users: newUsers });
65
56
  }
66
57
  }
67
- return { previousUser, previousCompany };
58
+ return { previousCompany };
68
59
  },
69
60
  onError: (err, _, context) => {
70
- if (context?.previousUser) {
71
- queryClient.setQueryData(['user'], context.previousUser);
72
- }
73
61
  if (context?.previousCompany) {
74
- queryClient.setQueryData(['company'], context.previousCompany);
62
+ queryClient.setQueryData(['company', this.companyId], context.previousCompany);
75
63
  }
76
64
  },
77
65
  onSettled: (data, error, variables) => {
@@ -209,7 +209,6 @@ export interface User {
209
209
  username: string;
210
210
  name: string;
211
211
  verified: boolean;
212
- companies: UserCompanyAssociation[] | null;
213
212
  email: string | null;
214
213
  phone_number: string | null;
215
214
  time_created: number;
@@ -374,7 +373,7 @@ export interface Company {
374
373
  incomplete_payments: PlanPayment[];
375
374
  overdue_threshold: number;
376
375
  stripe_account_id: string;
377
- is_restricted: false;
376
+ is_restricted: boolean;
378
377
  disabled_reason: string;
379
378
  completed_onboarding: boolean;
380
379
  restricted_soon: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.142",
3
+ "version": "0.0.2-beta.143",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",