@edgestore/react 0.5.3-alpha.0 → 0.5.4

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.
package/dist/index.js CHANGED
@@ -419,27 +419,37 @@ function EdgeStoreProviderInner({ children, context, basePath, maxConcurrentUplo
419
419
  });
420
420
  if (res.ok) {
421
421
  const json = await res.json();
422
- const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
423
- method: 'GET',
424
- credentials: 'include',
425
- headers: {
426
- 'x-edgestore-token': json.token
422
+ // Only call _init API if provider is edgestore
423
+ if (json.providerName === 'edgestore') {
424
+ const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
425
+ method: 'GET',
426
+ credentials: 'include',
427
+ headers: {
428
+ 'x-edgestore-token': json.token
429
+ }
430
+ });
431
+ if (innerRes.ok) {
432
+ // update state
433
+ setState({
434
+ loading: false,
435
+ initialized: true,
436
+ error: false
437
+ });
438
+ } else {
439
+ setState({
440
+ loading: false,
441
+ initialized: false,
442
+ error: true
443
+ });
444
+ throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
427
445
  }
428
- });
429
- if (innerRes.ok) {
430
- // update state
446
+ } else {
447
+ // For non-edgestore providers, just update state without calling _init
431
448
  setState({
432
449
  loading: false,
433
450
  initialized: true,
434
451
  error: false
435
452
  });
436
- } else {
437
- setState({
438
- loading: false,
439
- initialized: false,
440
- error: true
441
- });
442
- throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
443
453
  }
444
454
  } else {
445
455
  setState({
package/dist/index.mjs CHANGED
@@ -395,27 +395,37 @@ function EdgeStoreProviderInner({ children, context, basePath, maxConcurrentUplo
395
395
  });
396
396
  if (res.ok) {
397
397
  const json = await res.json();
398
- const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
399
- method: 'GET',
400
- credentials: 'include',
401
- headers: {
402
- 'x-edgestore-token': json.token
398
+ // Only call _init API if provider is edgestore
399
+ if (json.providerName === 'edgestore') {
400
+ const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
401
+ method: 'GET',
402
+ credentials: 'include',
403
+ headers: {
404
+ 'x-edgestore-token': json.token
405
+ }
406
+ });
407
+ if (innerRes.ok) {
408
+ // update state
409
+ setState({
410
+ loading: false,
411
+ initialized: true,
412
+ error: false
413
+ });
414
+ } else {
415
+ setState({
416
+ loading: false,
417
+ initialized: false,
418
+ error: true
419
+ });
420
+ throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
403
421
  }
404
- });
405
- if (innerRes.ok) {
406
- // update state
422
+ } else {
423
+ // For non-edgestore providers, just update state without calling _init
407
424
  setState({
408
425
  loading: false,
409
426
  initialized: true,
410
427
  error: false
411
428
  });
412
- } else {
413
- setState({
414
- loading: false,
415
- initialized: false,
416
- error: true
417
- });
418
- throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
419
429
  }
420
430
  } else {
421
431
  setState({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestore/react",
3
- "version": "0.5.3-alpha.0",
3
+ "version": "0.5.4",
4
4
  "description": "Upload files with ease from React/Next.js",
5
5
  "homepage": "https://edgestore.dev",
6
6
  "repository": "https://github.com/edgestorejs/edgestore.git",
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@aws-sdk/client-s3": "^3.294.0",
68
68
  "@aws-sdk/s3-request-presigner": "^3.294.0",
69
- "@edgestore/shared": "0.5.3-alpha.0",
69
+ "@edgestore/shared": "0.5.4",
70
70
  "@panva/hkdf": "^1.0.4",
71
71
  "cookie": "^0.5.0",
72
72
  "jose": "^4.13.1",
@@ -88,5 +88,5 @@
88
88
  "typescript": "^5",
89
89
  "zod": "3.25.42"
90
90
  },
91
- "gitHead": "8a6f2d56d78f1a392ca7b8be93ec277f4b973461"
91
+ "gitHead": "d553cf3a620a9331caca7570c20fdee5c9b45ebe"
92
92
  }
@@ -157,27 +157,38 @@ function EdgeStoreProviderInner<TRouter extends AnyRouter>({
157
157
  });
158
158
  if (res.ok) {
159
159
  const json = await res.json();
160
- const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
161
- method: 'GET',
162
- credentials: 'include',
163
- headers: {
164
- 'x-edgestore-token': json.token,
165
- },
166
- });
167
- if (innerRes.ok) {
168
- // update state
169
- setState({
170
- loading: false,
171
- initialized: true,
172
- error: false,
160
+
161
+ // Only call _init API if provider is edgestore
162
+ if (json.providerName === 'edgestore') {
163
+ const innerRes = await fetch(`${DEFAULT_BASE_URL}/_init`, {
164
+ method: 'GET',
165
+ credentials: 'include',
166
+ headers: {
167
+ 'x-edgestore-token': json.token,
168
+ },
173
169
  });
170
+ if (innerRes.ok) {
171
+ // update state
172
+ setState({
173
+ loading: false,
174
+ initialized: true,
175
+ error: false,
176
+ });
177
+ } else {
178
+ setState({
179
+ loading: false,
180
+ initialized: false,
181
+ error: true,
182
+ });
183
+ throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
184
+ }
174
185
  } else {
186
+ // For non-edgestore providers, just update state without calling _init
175
187
  setState({
176
188
  loading: false,
177
- initialized: false,
178
- error: true,
189
+ initialized: true,
190
+ error: false,
179
191
  });
180
- throw new EdgeStoreClientError("Couldn't initialize EdgeStore.");
181
192
  }
182
193
  } else {
183
194
  setState({