@go-avro/avro-js 0.0.2-beta.131 → 0.0.2-beta.133

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.
@@ -10,14 +10,10 @@ AvroQueryClient.prototype.useGetJobs = function (onProgress) {
10
10
  return useQuery({
11
11
  queryKey: ['jobs', this.companyId, this.company?.num_jobs],
12
12
  queryFn: async () => {
13
- if (this.company?.num_jobs === 0) {
14
- onProgress?.(1);
15
- return [];
16
- }
17
13
  onProgress?.(0);
18
- const pageCount = amt ? Math.ceil((this.company?.num_jobs ?? 0) / amt) : 0;
14
+ const pageCount = amt ? Math.ceil((this.company?.num_jobs ?? 0) / amt) + 1 : 1;
19
15
  let completed = 0;
20
- const promises = Array.from({ length: pageCount }, (_, i) => this.fetchJobs({ offset: i * amt, amt }));
16
+ const promises = Array.from({ length: pageCount }, (_, i) => this.fetchJobs({ offset: i * (amt ?? 1), amt }));
21
17
  const trackedPromises = promises.map((promise) => promise.then((result) => {
22
18
  completed++;
23
19
  const fraction = completed / pageCount;
@@ -8,11 +8,11 @@ AvroQueryClient.prototype.useGetRoutes = function (body, total, onProgress) {
8
8
  return this.fetchRoutes({ ...body, offset: 0 });
9
9
  }
10
10
  onProgress?.(0);
11
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
11
+ const pageCount = body.amt ? Math.ceil(total / body.amt) + 1 : 1;
12
12
  let completed = 0;
13
13
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchRoutes({
14
14
  ...body,
15
- offset: i * (body.amt ?? 0),
15
+ offset: i * (body.amt ?? 1),
16
16
  }));
17
17
  const trackedPromises = promises.map((promise) => promise.then((result) => {
18
18
  completed++;
@@ -22,11 +22,11 @@ AvroQueryClient.prototype.useGetSkills = function (body, total, onProgress) {
22
22
  return this.fetchSkills({ ...body, offset: 0 });
23
23
  }
24
24
  onProgress?.(0);
25
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
25
+ const pageCount = body.amt ? Math.ceil(total / body.amt) + 1 : 1;
26
26
  let completed = 0;
27
27
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchSkills({
28
28
  ...body,
29
- offset: i * (body.amt ?? 0),
29
+ offset: i * (body.amt ?? 1),
30
30
  }));
31
31
  const trackedPromises = promises.map((promise) => promise.then((result) => {
32
32
  completed++;
@@ -8,11 +8,11 @@ AvroQueryClient.prototype.useGetTeams = function (body, total, onProgress) {
8
8
  return this.fetchTeams({ ...body, offset: 0 });
9
9
  }
10
10
  onProgress?.(0);
11
- const pageCount = body.amt ? Math.ceil(total / body.amt) : 0;
11
+ const pageCount = body.amt ? Math.ceil(total / body.amt) + 1 : 1;
12
12
  let completed = 0;
13
13
  const promises = Array.from({ length: pageCount }, (_, i) => this.fetchTeams({
14
14
  ...body,
15
- offset: i * (body.amt ?? 0),
15
+ offset: i * (body.amt ?? 1),
16
16
  }));
17
17
  const trackedPromises = promises.map((promise) => promise.then((result) => {
18
18
  completed++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.131",
3
+ "version": "0.0.2-beta.133",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",