@bigbinary/neeto-github-frontend 1.1.0-beta3 → 2.0.0

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
@@ -1,884 +1,28 @@
1
- import * as React from 'react';
2
1
  import { useState, createElement, useRef } from 'react';
3
2
  import classnames from 'classnames';
4
3
  import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
5
4
  import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
6
5
  import { Trans, useTranslation } from 'react-i18next';
7
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
+ import { useQuery } from '@tanstack/react-query';
8
7
  import { isNotNil } from 'ramda';
9
8
  import axios from 'axios';
10
9
  import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
11
10
  import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
12
- import { Github } from '@bigbinary/neeto-icons/misc';
11
+ import Github from '@bigbinary/neeto-icons/misc/Github';
13
12
  import Typography from '@bigbinary/neetoui/Typography';
14
- import { Settings, Plus, Building, Lock } from '@bigbinary/neeto-icons';
13
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
14
+ import Building from '@bigbinary/neeto-icons/Building';
15
15
  import Avatar from '@bigbinary/neetoui/Avatar';
16
16
  import Button from '@bigbinary/neetoui/Button';
17
- import { isPresent, findBy, noop as noop$1 } from '@bigbinary/neeto-cist';
17
+ import Plus from '@bigbinary/neeto-icons/Plus';
18
+ import Settings from '@bigbinary/neeto-icons/Settings';
19
+ import { isPresent, findBy, noop } from '@bigbinary/neeto-cist';
18
20
  import Search from '@bigbinary/neeto-molecules/Search';
21
+ import Lock from '@bigbinary/neeto-icons/Lock';
19
22
  import DateFormat from '@bigbinary/neeto-molecules/DateFormat';
20
23
  import Pane from '@bigbinary/neetoui/Pane';
21
24
  import require$$0 from 'util';
22
25
 
23
- // src/subscribable.ts
24
- var Subscribable = class {
25
- constructor() {
26
- this.listeners = /* @__PURE__ */ new Set();
27
- this.subscribe = this.subscribe.bind(this);
28
- }
29
- subscribe(listener) {
30
- this.listeners.add(listener);
31
- this.onSubscribe();
32
- return () => {
33
- this.listeners.delete(listener);
34
- this.onUnsubscribe();
35
- };
36
- }
37
- hasListeners() {
38
- return this.listeners.size > 0;
39
- }
40
- onSubscribe() {
41
- }
42
- onUnsubscribe() {
43
- }
44
- };
45
-
46
- // src/utils.ts
47
- var isServer = typeof window === "undefined" || "Deno" in globalThis;
48
- function noop() {
49
- return void 0;
50
- }
51
- function isValidTimeout(value) {
52
- return typeof value === "number" && value >= 0 && value !== Infinity;
53
- }
54
- function timeUntilStale(updatedAt, staleTime) {
55
- return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
56
- }
57
- function replaceEqualDeep(a, b) {
58
- if (a === b) {
59
- return a;
60
- }
61
- const array = isPlainArray(a) && isPlainArray(b);
62
- if (array || isPlainObject(a) && isPlainObject(b)) {
63
- const aItems = array ? a : Object.keys(a);
64
- const aSize = aItems.length;
65
- const bItems = array ? b : Object.keys(b);
66
- const bSize = bItems.length;
67
- const copy = array ? [] : {};
68
- let equalItems = 0;
69
- for (let i = 0; i < bSize; i++) {
70
- const key = array ? i : bItems[i];
71
- if ((!array && aItems.includes(key) || array) && a[key] === void 0 && b[key] === void 0) {
72
- copy[key] = void 0;
73
- equalItems++;
74
- } else {
75
- copy[key] = replaceEqualDeep(a[key], b[key]);
76
- if (copy[key] === a[key] && a[key] !== void 0) {
77
- equalItems++;
78
- }
79
- }
80
- }
81
- return aSize === bSize && equalItems === aSize ? a : copy;
82
- }
83
- return b;
84
- }
85
- function shallowEqualObjects(a, b) {
86
- if (!b || Object.keys(a).length !== Object.keys(b).length) {
87
- return false;
88
- }
89
- for (const key in a) {
90
- if (a[key] !== b[key]) {
91
- return false;
92
- }
93
- }
94
- return true;
95
- }
96
- function isPlainArray(value) {
97
- return Array.isArray(value) && value.length === Object.keys(value).length;
98
- }
99
- function isPlainObject(o) {
100
- if (!hasObjectPrototype(o)) {
101
- return false;
102
- }
103
- const ctor = o.constructor;
104
- if (ctor === void 0) {
105
- return true;
106
- }
107
- const prot = ctor.prototype;
108
- if (!hasObjectPrototype(prot)) {
109
- return false;
110
- }
111
- if (!prot.hasOwnProperty("isPrototypeOf")) {
112
- return false;
113
- }
114
- if (Object.getPrototypeOf(o) !== Object.prototype) {
115
- return false;
116
- }
117
- return true;
118
- }
119
- function hasObjectPrototype(o) {
120
- return Object.prototype.toString.call(o) === "[object Object]";
121
- }
122
- function replaceData(prevData, data, options) {
123
- if (typeof options.structuralSharing === "function") {
124
- return options.structuralSharing(prevData, data);
125
- } else if (options.structuralSharing !== false) {
126
- return replaceEqualDeep(prevData, data);
127
- }
128
- return data;
129
- }
130
-
131
- // src/focusManager.ts
132
- var FocusManager = class extends Subscribable {
133
- #focused;
134
- #cleanup;
135
- #setup;
136
- constructor() {
137
- super();
138
- this.#setup = (onFocus) => {
139
- if (!isServer && window.addEventListener) {
140
- const listener = () => onFocus();
141
- window.addEventListener("visibilitychange", listener, false);
142
- return () => {
143
- window.removeEventListener("visibilitychange", listener);
144
- };
145
- }
146
- return;
147
- };
148
- }
149
- onSubscribe() {
150
- if (!this.#cleanup) {
151
- this.setEventListener(this.#setup);
152
- }
153
- }
154
- onUnsubscribe() {
155
- if (!this.hasListeners()) {
156
- this.#cleanup?.();
157
- this.#cleanup = void 0;
158
- }
159
- }
160
- setEventListener(setup) {
161
- this.#setup = setup;
162
- this.#cleanup?.();
163
- this.#cleanup = setup((focused) => {
164
- if (typeof focused === "boolean") {
165
- this.setFocused(focused);
166
- } else {
167
- this.onFocus();
168
- }
169
- });
170
- }
171
- setFocused(focused) {
172
- const changed = this.#focused !== focused;
173
- if (changed) {
174
- this.#focused = focused;
175
- this.onFocus();
176
- }
177
- }
178
- onFocus() {
179
- const isFocused = this.isFocused();
180
- this.listeners.forEach((listener) => {
181
- listener(isFocused);
182
- });
183
- }
184
- isFocused() {
185
- if (typeof this.#focused === "boolean") {
186
- return this.#focused;
187
- }
188
- return globalThis.document?.visibilityState !== "hidden";
189
- }
190
- };
191
- var focusManager = new FocusManager();
192
-
193
- // src/onlineManager.ts
194
- var OnlineManager = class extends Subscribable {
195
- #online = true;
196
- #cleanup;
197
- #setup;
198
- constructor() {
199
- super();
200
- this.#setup = (onOnline) => {
201
- if (!isServer && window.addEventListener) {
202
- const onlineListener = () => onOnline(true);
203
- const offlineListener = () => onOnline(false);
204
- window.addEventListener("online", onlineListener, false);
205
- window.addEventListener("offline", offlineListener, false);
206
- return () => {
207
- window.removeEventListener("online", onlineListener);
208
- window.removeEventListener("offline", offlineListener);
209
- };
210
- }
211
- return;
212
- };
213
- }
214
- onSubscribe() {
215
- if (!this.#cleanup) {
216
- this.setEventListener(this.#setup);
217
- }
218
- }
219
- onUnsubscribe() {
220
- if (!this.hasListeners()) {
221
- this.#cleanup?.();
222
- this.#cleanup = void 0;
223
- }
224
- }
225
- setEventListener(setup) {
226
- this.#setup = setup;
227
- this.#cleanup?.();
228
- this.#cleanup = setup(this.setOnline.bind(this));
229
- }
230
- setOnline(online) {
231
- const changed = this.#online !== online;
232
- if (changed) {
233
- this.#online = online;
234
- this.listeners.forEach((listener) => {
235
- listener(online);
236
- });
237
- }
238
- }
239
- isOnline() {
240
- return this.#online;
241
- }
242
- };
243
- var onlineManager = new OnlineManager();
244
-
245
- // src/retryer.ts
246
- function canFetch(networkMode) {
247
- return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
248
- }
249
-
250
- // src/notifyManager.ts
251
- function createNotifyManager() {
252
- let queue = [];
253
- let transactions = 0;
254
- let notifyFn = (callback) => {
255
- callback();
256
- };
257
- let batchNotifyFn = (callback) => {
258
- callback();
259
- };
260
- let scheduleFn = (cb) => setTimeout(cb, 0);
261
- const setScheduler = (fn) => {
262
- scheduleFn = fn;
263
- };
264
- const batch = (callback) => {
265
- let result;
266
- transactions++;
267
- try {
268
- result = callback();
269
- } finally {
270
- transactions--;
271
- if (!transactions) {
272
- flush();
273
- }
274
- }
275
- return result;
276
- };
277
- const schedule = (callback) => {
278
- if (transactions) {
279
- queue.push(callback);
280
- } else {
281
- scheduleFn(() => {
282
- notifyFn(callback);
283
- });
284
- }
285
- };
286
- const batchCalls = (callback) => {
287
- return (...args) => {
288
- schedule(() => {
289
- callback(...args);
290
- });
291
- };
292
- };
293
- const flush = () => {
294
- const originalQueue = queue;
295
- queue = [];
296
- if (originalQueue.length) {
297
- scheduleFn(() => {
298
- batchNotifyFn(() => {
299
- originalQueue.forEach((callback) => {
300
- notifyFn(callback);
301
- });
302
- });
303
- });
304
- }
305
- };
306
- const setNotifyFunction = (fn) => {
307
- notifyFn = fn;
308
- };
309
- const setBatchNotifyFunction = (fn) => {
310
- batchNotifyFn = fn;
311
- };
312
- return {
313
- batch,
314
- batchCalls,
315
- schedule,
316
- setNotifyFunction,
317
- setBatchNotifyFunction,
318
- setScheduler
319
- };
320
- }
321
- var notifyManager = createNotifyManager();
322
-
323
- // src/query.ts
324
- function fetchState(data, options) {
325
- return {
326
- fetchFailureCount: 0,
327
- fetchFailureReason: null,
328
- fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
329
- ...data === void 0 && {
330
- error: null,
331
- status: "pending"
332
- }
333
- };
334
- }
335
-
336
- // src/queryObserver.ts
337
- var QueryObserver = class extends Subscribable {
338
- constructor(client, options) {
339
- super();
340
- this.options = options;
341
- this.#client = client;
342
- this.#selectError = null;
343
- this.bindMethods();
344
- this.setOptions(options);
345
- }
346
- #client;
347
- #currentQuery = void 0;
348
- #currentQueryInitialState = void 0;
349
- #currentResult = void 0;
350
- #currentResultState;
351
- #currentResultOptions;
352
- #selectError;
353
- #selectFn;
354
- #selectResult;
355
- // This property keeps track of the last query with defined data.
356
- // It will be used to pass the previous data and query to the placeholder function between renders.
357
- #lastQueryWithDefinedData;
358
- #staleTimeoutId;
359
- #refetchIntervalId;
360
- #currentRefetchInterval;
361
- #trackedProps = /* @__PURE__ */ new Set();
362
- bindMethods() {
363
- this.refetch = this.refetch.bind(this);
364
- }
365
- onSubscribe() {
366
- if (this.listeners.size === 1) {
367
- this.#currentQuery.addObserver(this);
368
- if (shouldFetchOnMount(this.#currentQuery, this.options)) {
369
- this.#executeFetch();
370
- } else {
371
- this.updateResult();
372
- }
373
- this.#updateTimers();
374
- }
375
- }
376
- onUnsubscribe() {
377
- if (!this.hasListeners()) {
378
- this.destroy();
379
- }
380
- }
381
- shouldFetchOnReconnect() {
382
- return shouldFetchOn(
383
- this.#currentQuery,
384
- this.options,
385
- this.options.refetchOnReconnect
386
- );
387
- }
388
- shouldFetchOnWindowFocus() {
389
- return shouldFetchOn(
390
- this.#currentQuery,
391
- this.options,
392
- this.options.refetchOnWindowFocus
393
- );
394
- }
395
- destroy() {
396
- this.listeners = /* @__PURE__ */ new Set();
397
- this.#clearStaleTimeout();
398
- this.#clearRefetchInterval();
399
- this.#currentQuery.removeObserver(this);
400
- }
401
- setOptions(options, notifyOptions) {
402
- const prevOptions = this.options;
403
- const prevQuery = this.#currentQuery;
404
- this.options = this.#client.defaultQueryOptions(options);
405
- if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean") {
406
- throw new Error("Expected enabled to be a boolean");
407
- }
408
- this.#updateQuery();
409
- this.#currentQuery.setOptions(this.options);
410
- if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
411
- this.#client.getQueryCache().notify({
412
- type: "observerOptionsUpdated",
413
- query: this.#currentQuery,
414
- observer: this
415
- });
416
- }
417
- const mounted = this.hasListeners();
418
- if (mounted && shouldFetchOptionally(
419
- this.#currentQuery,
420
- prevQuery,
421
- this.options,
422
- prevOptions
423
- )) {
424
- this.#executeFetch();
425
- }
426
- this.updateResult(notifyOptions);
427
- if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
428
- this.#updateStaleTimeout();
429
- }
430
- const nextRefetchInterval = this.#computeRefetchInterval();
431
- if (mounted && (this.#currentQuery !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== this.#currentRefetchInterval)) {
432
- this.#updateRefetchInterval(nextRefetchInterval);
433
- }
434
- }
435
- getOptimisticResult(options) {
436
- const query = this.#client.getQueryCache().build(this.#client, options);
437
- const result = this.createResult(query, options);
438
- if (shouldAssignObserverCurrentProperties(this, result)) {
439
- this.#currentResult = result;
440
- this.#currentResultOptions = this.options;
441
- this.#currentResultState = this.#currentQuery.state;
442
- }
443
- return result;
444
- }
445
- getCurrentResult() {
446
- return this.#currentResult;
447
- }
448
- trackResult(result, onPropTracked) {
449
- const trackedResult = {};
450
- Object.keys(result).forEach((key) => {
451
- Object.defineProperty(trackedResult, key, {
452
- configurable: false,
453
- enumerable: true,
454
- get: () => {
455
- this.trackProp(key);
456
- onPropTracked?.(key);
457
- return result[key];
458
- }
459
- });
460
- });
461
- return trackedResult;
462
- }
463
- trackProp(key) {
464
- this.#trackedProps.add(key);
465
- }
466
- getCurrentQuery() {
467
- return this.#currentQuery;
468
- }
469
- refetch({ ...options } = {}) {
470
- return this.fetch({
471
- ...options
472
- });
473
- }
474
- fetchOptimistic(options) {
475
- const defaultedOptions = this.#client.defaultQueryOptions(options);
476
- const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
477
- query.isFetchingOptimistic = true;
478
- return query.fetch().then(() => this.createResult(query, defaultedOptions));
479
- }
480
- fetch(fetchOptions) {
481
- return this.#executeFetch({
482
- ...fetchOptions,
483
- cancelRefetch: fetchOptions.cancelRefetch ?? true
484
- }).then(() => {
485
- this.updateResult();
486
- return this.#currentResult;
487
- });
488
- }
489
- #executeFetch(fetchOptions) {
490
- this.#updateQuery();
491
- let promise = this.#currentQuery.fetch(
492
- this.options,
493
- fetchOptions
494
- );
495
- if (!fetchOptions?.throwOnError) {
496
- promise = promise.catch(noop);
497
- }
498
- return promise;
499
- }
500
- #updateStaleTimeout() {
501
- this.#clearStaleTimeout();
502
- if (isServer || this.#currentResult.isStale || !isValidTimeout(this.options.staleTime)) {
503
- return;
504
- }
505
- const time = timeUntilStale(
506
- this.#currentResult.dataUpdatedAt,
507
- this.options.staleTime
508
- );
509
- const timeout = time + 1;
510
- this.#staleTimeoutId = setTimeout(() => {
511
- if (!this.#currentResult.isStale) {
512
- this.updateResult();
513
- }
514
- }, timeout);
515
- }
516
- #computeRefetchInterval() {
517
- return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
518
- }
519
- #updateRefetchInterval(nextInterval) {
520
- this.#clearRefetchInterval();
521
- this.#currentRefetchInterval = nextInterval;
522
- if (isServer || this.options.enabled === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
523
- return;
524
- }
525
- this.#refetchIntervalId = setInterval(() => {
526
- if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
527
- this.#executeFetch();
528
- }
529
- }, this.#currentRefetchInterval);
530
- }
531
- #updateTimers() {
532
- this.#updateStaleTimeout();
533
- this.#updateRefetchInterval(this.#computeRefetchInterval());
534
- }
535
- #clearStaleTimeout() {
536
- if (this.#staleTimeoutId) {
537
- clearTimeout(this.#staleTimeoutId);
538
- this.#staleTimeoutId = void 0;
539
- }
540
- }
541
- #clearRefetchInterval() {
542
- if (this.#refetchIntervalId) {
543
- clearInterval(this.#refetchIntervalId);
544
- this.#refetchIntervalId = void 0;
545
- }
546
- }
547
- createResult(query, options) {
548
- const prevQuery = this.#currentQuery;
549
- const prevOptions = this.options;
550
- const prevResult = this.#currentResult;
551
- const prevResultState = this.#currentResultState;
552
- const prevResultOptions = this.#currentResultOptions;
553
- const queryChange = query !== prevQuery;
554
- const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
555
- const { state } = query;
556
- let newState = { ...state };
557
- let isPlaceholderData = false;
558
- let data;
559
- if (options._optimisticResults) {
560
- const mounted = this.hasListeners();
561
- const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
562
- const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
563
- if (fetchOnMount || fetchOptionally) {
564
- newState = {
565
- ...newState,
566
- ...fetchState(state.data, query.options)
567
- };
568
- }
569
- if (options._optimisticResults === "isRestoring") {
570
- newState.fetchStatus = "idle";
571
- }
572
- }
573
- let { error, errorUpdatedAt, status } = newState;
574
- if (options.select && newState.data !== void 0) {
575
- if (prevResult && newState.data === prevResultState?.data && options.select === this.#selectFn) {
576
- data = this.#selectResult;
577
- } else {
578
- try {
579
- this.#selectFn = options.select;
580
- data = options.select(newState.data);
581
- data = replaceData(prevResult?.data, data, options);
582
- this.#selectResult = data;
583
- this.#selectError = null;
584
- } catch (selectError) {
585
- this.#selectError = selectError;
586
- }
587
- }
588
- } else {
589
- data = newState.data;
590
- }
591
- if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
592
- let placeholderData;
593
- if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
594
- placeholderData = prevResult.data;
595
- } else {
596
- placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
597
- this.#lastQueryWithDefinedData?.state.data,
598
- this.#lastQueryWithDefinedData
599
- ) : options.placeholderData;
600
- if (options.select && placeholderData !== void 0) {
601
- try {
602
- placeholderData = options.select(placeholderData);
603
- this.#selectError = null;
604
- } catch (selectError) {
605
- this.#selectError = selectError;
606
- }
607
- }
608
- }
609
- if (placeholderData !== void 0) {
610
- status = "success";
611
- data = replaceData(
612
- prevResult?.data,
613
- placeholderData,
614
- options
615
- );
616
- isPlaceholderData = true;
617
- }
618
- }
619
- if (this.#selectError) {
620
- error = this.#selectError;
621
- data = this.#selectResult;
622
- errorUpdatedAt = Date.now();
623
- status = "error";
624
- }
625
- const isFetching = newState.fetchStatus === "fetching";
626
- const isPending = status === "pending";
627
- const isError = status === "error";
628
- const isLoading = isPending && isFetching;
629
- const hasData = data !== void 0;
630
- const result = {
631
- status,
632
- fetchStatus: newState.fetchStatus,
633
- isPending,
634
- isSuccess: status === "success",
635
- isError,
636
- isInitialLoading: isLoading,
637
- isLoading,
638
- data,
639
- dataUpdatedAt: newState.dataUpdatedAt,
640
- error,
641
- errorUpdatedAt,
642
- failureCount: newState.fetchFailureCount,
643
- failureReason: newState.fetchFailureReason,
644
- errorUpdateCount: newState.errorUpdateCount,
645
- isFetched: newState.dataUpdateCount > 0 || newState.errorUpdateCount > 0,
646
- isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
647
- isFetching,
648
- isRefetching: isFetching && !isPending,
649
- isLoadingError: isError && !hasData,
650
- isPaused: newState.fetchStatus === "paused",
651
- isPlaceholderData,
652
- isRefetchError: isError && hasData,
653
- isStale: isStale(query, options),
654
- refetch: this.refetch
655
- };
656
- return result;
657
- }
658
- updateResult(notifyOptions) {
659
- const prevResult = this.#currentResult;
660
- const nextResult = this.createResult(this.#currentQuery, this.options);
661
- this.#currentResultState = this.#currentQuery.state;
662
- this.#currentResultOptions = this.options;
663
- if (this.#currentResultState.data !== void 0) {
664
- this.#lastQueryWithDefinedData = this.#currentQuery;
665
- }
666
- if (shallowEqualObjects(nextResult, prevResult)) {
667
- return;
668
- }
669
- this.#currentResult = nextResult;
670
- const defaultNotifyOptions = {};
671
- const shouldNotifyListeners = () => {
672
- if (!prevResult) {
673
- return true;
674
- }
675
- const { notifyOnChangeProps } = this.options;
676
- const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
677
- if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
678
- return true;
679
- }
680
- const includedProps = new Set(
681
- notifyOnChangePropsValue ?? this.#trackedProps
682
- );
683
- if (this.options.throwOnError) {
684
- includedProps.add("error");
685
- }
686
- return Object.keys(this.#currentResult).some((key) => {
687
- const typedKey = key;
688
- const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
689
- return changed && includedProps.has(typedKey);
690
- });
691
- };
692
- if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {
693
- defaultNotifyOptions.listeners = true;
694
- }
695
- this.#notify({ ...defaultNotifyOptions, ...notifyOptions });
696
- }
697
- #updateQuery() {
698
- const query = this.#client.getQueryCache().build(this.#client, this.options);
699
- if (query === this.#currentQuery) {
700
- return;
701
- }
702
- const prevQuery = this.#currentQuery;
703
- this.#currentQuery = query;
704
- this.#currentQueryInitialState = query.state;
705
- if (this.hasListeners()) {
706
- prevQuery?.removeObserver(this);
707
- query.addObserver(this);
708
- }
709
- }
710
- onQueryUpdate() {
711
- this.updateResult();
712
- if (this.hasListeners()) {
713
- this.#updateTimers();
714
- }
715
- }
716
- #notify(notifyOptions) {
717
- notifyManager.batch(() => {
718
- if (notifyOptions.listeners) {
719
- this.listeners.forEach((listener) => {
720
- listener(this.#currentResult);
721
- });
722
- }
723
- this.#client.getQueryCache().notify({
724
- query: this.#currentQuery,
725
- type: "observerResultsUpdated"
726
- });
727
- });
728
- }
729
- };
730
- function shouldLoadOnMount(query, options) {
731
- return options.enabled !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
732
- }
733
- function shouldFetchOnMount(query, options) {
734
- return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
735
- }
736
- function shouldFetchOn(query, options, field) {
737
- if (options.enabled !== false) {
738
- const value = typeof field === "function" ? field(query) : field;
739
- return value === "always" || value !== false && isStale(query, options);
740
- }
741
- return false;
742
- }
743
- function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
744
- return (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
745
- }
746
- function isStale(query, options) {
747
- return options.enabled !== false && query.isStaleByTime(options.staleTime);
748
- }
749
- function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
750
- if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
751
- return true;
752
- }
753
- return false;
754
- }
755
-
756
- var QueryClientContext = React.createContext(
757
- void 0
758
- );
759
- var useQueryClient = (queryClient) => {
760
- const client = React.useContext(QueryClientContext);
761
- if (queryClient) {
762
- return queryClient;
763
- }
764
- if (!client) {
765
- throw new Error("No QueryClient set, use QueryClientProvider to set one");
766
- }
767
- return client;
768
- };
769
-
770
- var IsRestoringContext = React.createContext(false);
771
- var useIsRestoring = () => React.useContext(IsRestoringContext);
772
- IsRestoringContext.Provider;
773
-
774
- function createValue() {
775
- let isReset = false;
776
- return {
777
- clearReset: () => {
778
- isReset = false;
779
- },
780
- reset: () => {
781
- isReset = true;
782
- },
783
- isReset: () => {
784
- return isReset;
785
- }
786
- };
787
- }
788
- var QueryErrorResetBoundaryContext = React.createContext(createValue());
789
- var useQueryErrorResetBoundary = () => React.useContext(QueryErrorResetBoundaryContext);
790
-
791
- // src/utils.ts
792
- function shouldThrowError(throwError, params) {
793
- if (typeof throwError === "function") {
794
- return throwError(...params);
795
- }
796
- return !!throwError;
797
- }
798
-
799
- var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary) => {
800
- if (options.suspense || options.throwOnError) {
801
- if (!errorResetBoundary.isReset()) {
802
- options.retryOnMount = false;
803
- }
804
- }
805
- };
806
- var useClearResetErrorBoundary = (errorResetBoundary) => {
807
- React.useEffect(() => {
808
- errorResetBoundary.clearReset();
809
- }, [errorResetBoundary]);
810
- };
811
- var getHasError = ({
812
- result,
813
- errorResetBoundary,
814
- throwOnError,
815
- query
816
- }) => {
817
- return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && shouldThrowError(throwOnError, [result.error, query]);
818
- };
819
-
820
- // src/suspense.ts
821
- var ensureStaleTime = (defaultedOptions) => {
822
- if (defaultedOptions.suspense) {
823
- if (typeof defaultedOptions.staleTime !== "number") {
824
- defaultedOptions.staleTime = 1e3;
825
- }
826
- }
827
- };
828
- var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
829
- var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
830
- errorResetBoundary.clearReset();
831
- });
832
-
833
- function useBaseQuery(options, Observer, queryClient) {
834
- const client = useQueryClient(queryClient);
835
- const isRestoring = useIsRestoring();
836
- const errorResetBoundary = useQueryErrorResetBoundary();
837
- const defaultedOptions = client.defaultQueryOptions(options);
838
- defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
839
- ensureStaleTime(defaultedOptions);
840
- ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary);
841
- useClearResetErrorBoundary(errorResetBoundary);
842
- const [observer] = React.useState(
843
- () => new Observer(
844
- client,
845
- defaultedOptions
846
- )
847
- );
848
- const result = observer.getOptimisticResult(defaultedOptions);
849
- React.useSyncExternalStore(
850
- React.useCallback(
851
- (onStoreChange) => {
852
- const unsubscribe = isRestoring ? () => void 0 : observer.subscribe(notifyManager.batchCalls(onStoreChange));
853
- observer.updateResult();
854
- return unsubscribe;
855
- },
856
- [observer, isRestoring]
857
- ),
858
- () => observer.getCurrentResult(),
859
- () => observer.getCurrentResult()
860
- );
861
- React.useEffect(() => {
862
- observer.setOptions(defaultedOptions, { listeners: false });
863
- }, [defaultedOptions, observer]);
864
- if (shouldSuspend(defaultedOptions, result)) {
865
- throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
866
- }
867
- if (getHasError({
868
- result,
869
- errorResetBoundary,
870
- throwOnError: defaultedOptions.throwOnError,
871
- query: client.getQueryCache().get(defaultedOptions.queryHash)
872
- })) {
873
- throw result.error;
874
- }
875
- return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
876
- }
877
-
878
- function useQuery(options, queryClient) {
879
- return useBaseQuery(options, QueryObserver, queryClient);
880
- }
881
-
882
26
  var _globalProps$organiza$1;
883
27
  var GITHUB_INTEGRATIONS_BASE_API_URL = "/github_integrations";
884
28
  ({
@@ -3655,7 +2799,7 @@ var NeetoGithubNanoPane = function NeetoGithubNanoPane(_ref) {
3655
2799
  _ref$troubleshootUrl = _ref.troubleshootUrl,
3656
2800
  troubleshootUrl = _ref$troubleshootUrl === void 0 ? TROUBLESHOOT_URL : _ref$troubleshootUrl,
3657
2801
  _ref$onConnect = _ref.onConnect,
3658
- onConnect = _ref$onConnect === void 0 ? noop$1 : _ref$onConnect,
2802
+ onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
3659
2803
  _ref$projects = _ref.projects,
3660
2804
  projects = _ref$projects === void 0 ? [] : _ref$projects,
3661
2805
  _ref$title = _ref.title,