Skip to content

Commit

Permalink
fix: fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
mbret committed Dec 31, 2024
1 parent ebf7fdc commit 7c26b27
Show file tree
Hide file tree
Showing 30 changed files with 88 additions and 88 deletions.
2 changes: 1 addition & 1 deletion src/lib/binding/useObservableCallback.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback } from "react";
import { useSubject } from "./useSubject";
import type { Observable } from "rxjs";
import { useSubject } from "./useSubject";

/**
* This creates an event handler and an observable that represents calls to that handler.
Expand Down
4 changes: 2 additions & 2 deletions src/lib/binding/useObservableState.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback } from "react";
import { useBehaviorSubject } from "./useBehaviorSubject";
import { useLiveRef } from "../utils/react/useLiveRef";
import type { Observable } from "rxjs";
import { useLiveRef } from "../utils/react/useLiveRef";
import { useBehaviorSubject } from "./useBehaviorSubject";

/**
* If you need to represent some piece of state as an observable and also want the ability to change
Expand Down
10 changes: 5 additions & 5 deletions src/lib/binding/useObserve.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { afterEach, describe, expect, expectTypeOf, it } from "vitest";
import { cleanup, render, renderHook } from "@testing-library/react";
import React, { act, memo, useEffect, useRef, useState } from "react";
import {
BehaviorSubject,
type Observable,
Expand All @@ -7,11 +8,10 @@ import {
of,
timer,
} from "rxjs";
import { useObserve } from "./useObserve";
import { render, renderHook, cleanup } from "@testing-library/react";
import React, { act, memo, useEffect, useRef, useState } from "react";
import { useBehaviorSubject } from "./useBehaviorSubject";
import { afterEach, describe, expect, expectTypeOf, it } from "vitest";
import { waitForTimeout } from "../../tests/utils";
import { useBehaviorSubject } from "./useBehaviorSubject";
import { useObserve } from "./useObserve";

afterEach(() => {
cleanup();
Expand Down
12 changes: 6 additions & 6 deletions src/lib/binding/useObserve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import {
useSyncExternalStore,
} from "react";
import {
type BehaviorSubject,
EMPTY,
type Observable,
tap,
distinctUntilChanged,
catchError,
EMPTY,
type BehaviorSubject,
startWith,
distinctUntilChanged,
identity,
startWith,
tap,
} from "rxjs";
import { useLiveRef } from "../utils/react/useLiveRef";
import { makeObservable } from "../utils/makeObservable";
import { useLiveRef } from "../utils/react/useLiveRef";

interface Option<R = undefined> {
defaultValue: R;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/binding/useSubject.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useRef } from "react";
import { Subject } from "rxjs";
import { useLiveRef } from "../utils/react/useLiveRef";
import { useConstant } from "../utils/react/useConstant";
import { useLiveRef } from "../utils/react/useLiveRef";

/**
* @see
Expand Down
6 changes: 3 additions & 3 deletions src/lib/binding/useSubscribe.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { afterEach, describe, expect, it } from "vitest";
import { type Observable, of, tap } from "rxjs";
import { renderHook, cleanup } from "@testing-library/react";
import { cleanup, renderHook } from "@testing-library/react";
import { useEffect, useState } from "react";
import { type Observable, of, tap } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { waitForTimeout } from "../../tests/utils";
import { useSubscribe } from "./useSubscribe";

Expand Down
4 changes: 2 additions & 2 deletions src/lib/binding/useSubscribe.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type DependencyList, useEffect } from "react";
import { EMPTY, catchError } from "rxjs";
import { makeObservable } from "../utils/makeObservable";
import { useLiveRef } from "../utils/react/useLiveRef";
import type { SubscribeSource } from "./types";
import { catchError, EMPTY } from "rxjs";
import { makeObservable } from "../utils/makeObservable";

export function useSubscribe<T>(
source: SubscribeSource<T> | (() => T),
Expand Down
4 changes: 2 additions & 2 deletions src/lib/binding/useSubscribeEffect.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type DependencyList, useCallback } from "react";
import { catchError, identity, retry } from "rxjs";
import { useSubscribe } from "./useSubscribe";
import { makeObservable } from "../utils/makeObservable";
import { useLiveRef } from "../utils/react/useLiveRef";
import type { SubscribeSource } from "./types";
import { makeObservable } from "../utils/makeObservable";
import { useSubscribe } from "./useSubscribe";

interface Option {
retry?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/queries/QueryClientProvider$.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { hashKey, type QueryKey } from "@tanstack/react-query";
import { type QueryKey, hashKey } from "@tanstack/react-query";
import { createContext, memo, useContext, useEffect, useState } from "react";
import {
fromEvent,
type Observable,
type Subscription,
takeUntil,
fromEvent,
share,
takeUntil,
} from "rxjs";

type CacheEntry = {
Expand Down
6 changes: 3 additions & 3 deletions src/lib/queries/useConcatMutation$.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import {
type QueryClient,
useQueryClient,
} from "@tanstack/react-query";
import { useCallback } from "react";
import {
BehaviorSubject,
type Subject,
filter,
first,
noop,
type Subject,
switchMap,
} from "rxjs";
import { useCallback } from "react";
import { useMutation$, type UseMutation$Options } from "./useMutation$";
import { type UseMutation$Options, useMutation$ } from "./useMutation$";

export function useContactMutation$<
TData = unknown,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/queries/useMutation$.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { afterEach, describe, expect, it } from "vitest";
import { finalize, takeUntil, timer, ReplaySubject } from "rxjs";
import { render, cleanup } from "@testing-library/react";
import React, { useEffect } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useMutation$ } from "./useMutation$";
import { cleanup, render } from "@testing-library/react";
import React, { useEffect } from "react";
import { ReplaySubject, finalize, takeUntil, timer } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { waitForTimeout } from "../../tests/utils";
import { QueryClientProvider$ } from "./QueryClientProvider$";
import { useMutation$ } from "./useMutation$";

afterEach(() => {
cleanup();
Expand Down
4 changes: 2 additions & 2 deletions src/lib/queries/useMutation$.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {
type DefaultError,
type QueryClient,
useMutation,
type UseMutationOptions,
type UseMutationResult,
useMutation,
} from "@tanstack/react-query";
import { useEffect } from "react";
import { type Observable, take } from "rxjs";
import { useBehaviorSubject } from "../binding/useBehaviorSubject";
import { useEffect } from "react";

export type UseMutation$Options<
TData = unknown,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/queries/useQuery$.cleanup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { afterEach, describe, expect, it } from "vitest";
import { finalize, timer } from "rxjs";
import { render, cleanup } from "@testing-library/react";
import { StrictMode } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useQuery$ } from "./useQuery$";
import { cleanup, render } from "@testing-library/react";
import { StrictMode } from "react";
import { finalize, timer } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { waitForTimeout } from "../../tests/utils";
import { QueryClient$, QueryClientProvider$ } from "./QueryClientProvider$";
import { useQuery$ } from "./useQuery$";

afterEach(() => {
cleanup();
Expand Down
10 changes: 5 additions & 5 deletions src/lib/queries/useQuery$.deduplication.test.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { afterEach, describe, expect, it } from "vitest";
import { Subject, interval, map, take, tap } from "rxjs";
import { render, cleanup } from "@testing-library/react";
import React from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useQuery$ } from "./useQuery$";
import { cleanup, render } from "@testing-library/react";
import React from "react";
import { Subject, interval, map, take, tap } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { QueryClientProvider$ } from "./QueryClientProvider$";
import { useQuery$ } from "./useQuery$";

afterEach(() => {
cleanup();
Expand Down
10 changes: 5 additions & 5 deletions src/lib/queries/useQuery$.invalidation.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { afterEach, describe, expect, it, vi } from "vitest";
import { render, cleanup } from "@testing-library/react";
import { of } from "rxjs";
import { useQuery$ } from "./useQuery$";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { cleanup, render } from "@testing-library/react";
import React, { act } from "react";
import { of } from "rxjs";
import { afterEach, describe, expect, it, vi } from "vitest";
import { printQuery } from "../../tests/testUtils";
import { QueryClientProvider$ } from "./QueryClientProvider$";
import React, { act } from "react";
import { useQuery$ } from "./useQuery$";

afterEach(() => {
cleanup();
Expand Down
12 changes: 6 additions & 6 deletions src/lib/queries/useQuery$.keys.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { afterEach, describe, expect, it } from "vitest";
import { Subject } from "rxjs";
import { render, cleanup } from "@testing-library/react";
import React from "react";
import { useQuery$ } from "./useQuery$";
import { QueryClientProvider } from "@tanstack/react-query";
import { printQuery } from "../../tests/testUtils";
import { QueryClient } from "@tanstack/react-query";
import { cleanup, render } from "@testing-library/react";
import React from "react";
import { Subject } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { printQuery } from "../../tests/testUtils";
import { waitForTimeout } from "../../tests/utils";
import { QueryClientProvider$ } from "./QueryClientProvider$";
import { useQuery$ } from "./useQuery$";

afterEach(() => {
cleanup();
Expand Down
10 changes: 5 additions & 5 deletions src/lib/queries/useQuery$.test.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { afterEach, describe, expect, it } from "vitest";
import { Subject, interval, takeWhile } from "rxjs";
import { render, cleanup } from "@testing-library/react";
import React, { memo, useEffect, useState } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { useQuery$ } from "./useQuery$";
import { cleanup, render } from "@testing-library/react";
import React, { memo, useEffect, useState } from "react";
import { Subject, interval, takeWhile } from "rxjs";
import { afterEach, describe, expect, it } from "vitest";
import { waitForTimeout } from "../../tests/utils";
import { QueryClientProvider$ } from "./QueryClientProvider$";
import { useQuery$ } from "./useQuery$";

afterEach(() => {
cleanup();
Expand Down
6 changes: 3 additions & 3 deletions src/lib/queries/useQuery$.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import {
type QueryClient,
type QueryFunctionContext,
type QueryKey,
useQuery,
useQueryClient,
type UseQueryOptions,
hashKey,
useQuery,
useQueryClient,
} from "@tanstack/react-query";
import { defer, delay, type Observable, take } from "rxjs";
import { type Observable, defer, delay, take } from "rxjs";
import { useQueryClient$ } from "./QueryClientProvider$";

export function useQuery$<
Expand Down
4 changes: 2 additions & 2 deletions src/lib/queries/useSwitchMutation$.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { DefaultError, QueryClient } from "@tanstack/react-query";
import { defaultIfEmpty, takeUntil } from "rxjs";
import { useCallback } from "react";
import { defaultIfEmpty, takeUntil } from "rxjs";
import { useObservableCallback } from "../binding/useObservableCallback";
import { useMutation$, type UseMutation$Options } from "./useMutation$";
import { type UseMutation$Options, useMutation$ } from "./useMutation$";

export function useSwitchMutation$<
TData = unknown,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/state/persistance/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { from, catchError, of, switchMap } from "rxjs";
import { catchError, from, of, switchMap } from "rxjs";
import type { Adapter } from "./adapters/Adapter";
import { IDENTIFIER_PERSISTANCE_KEY } from "./constants";
import type { SignalPersistenceConfig, PersistanceEntry } from "./types";
import type { PersistanceEntry, SignalPersistenceConfig } from "./types";

export const getNormalizedPersistanceValue = (unknownValue: unknown) => {
if (
Expand Down
4 changes: 2 additions & 2 deletions src/lib/state/persistance/persistSignals.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { firstValueFrom } from "rxjs";
import { describe, expect, it } from "vitest";
import { persistSignals } from "./persistSignals";
import { waitForTimeout } from "../../../tests/utils";
import { signal } from "../signal";
import { MockAdapter } from "./adapters/MockAdapter";
import { waitForTimeout } from "../../../tests/utils";
import { IDENTIFIER_PERSISTANCE_KEY } from "./constants";
import { persistSignals } from "./persistSignals";
import type { PersistanceEntry } from "./types";

describe("Given a storage that never resolves", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/state/persistance/persistSignals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
throttleTime,
zip,
} from "rxjs";
import type { SignalPersistenceConfig } from "./types";
import type { Signal } from "../signal";
import type { Adapter } from "./adapters/Adapter";
import { hydrateValueToSignal, persistValue } from "./helpers";
import type { SignalPersistenceConfig } from "./types";

export function persistSignals({
entries = [],
Expand Down
2 changes: 1 addition & 1 deletion src/lib/state/persistance/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { SignalValue, Signal } from "../signal";
import type { Signal, SignalValue } from "../signal";
import type { IDENTIFIER_PERSISTANCE_KEY } from "./constants";

export interface PersistanceEntry {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/state/react/usePersistSignals.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { useLiveRef } from "../../utils/react/useLiveRef";
import { useObserve } from "../../binding/useObserve";
import { concatMap, merge, of, scan, switchMap } from "rxjs";
import type { SignalPersistenceConfig } from "../persistance/types";
import { useLiveBehaviorSubject } from "../../binding/useLiveBehaviorSubject";
import { persistSignals } from "../persistance/persistSignals";
import type { Adapter } from "../persistance/adapters/Adapter";
import { useObserve } from "../../binding/useObserve";
import { useLiveRef } from "../../utils/react/useLiveRef";
import { shallowEqual } from "../../utils/shallowEqual";
import type { Adapter } from "../persistance/adapters/Adapter";
import { persistSignals } from "../persistance/persistSignals";
import type { SignalPersistenceConfig } from "../persistance/types";

/**
* Make sure to pass stable reference of entries and adapter if you don't
Expand Down
2 changes: 1 addition & 1 deletion src/lib/state/signal.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { renderHook } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { signal } from "./signal";
import { SIGNAL_RESET } from "./constants";
import { useSignalValue } from "./react/useSignalValue";
import { signal } from "./signal";

describe("signal", () => {
describe("Given a number signal with default value", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/operators/retryBackoff.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defer, type Observable, throwError, timer, merge, of } from "rxjs";
import { type Observable, defer, merge, of, throwError, timer } from "rxjs";
import {
catchError,
concatMap,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/react/useLiveRef.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { renderHook } from "@testing-library/react";
import { describe, expect, test } from "vitest";

import { useLiveRef } from "./useLiveRef";
import { act } from "react";
import { useLiveRef } from "./useLiveRef";

describe("useLiveRef", () => {
test("should return a ref object with an initial value", () => {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/react/useUnmountObservable.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { render } from "@testing-library/react";
import { useUnmountObservable } from "./useUnmountObservable";
import { describe, expect, it } from "vitest";
import { StrictMode, useEffect } from "react";
import { BehaviorSubject, takeUntil } from "rxjs";
import { describe, expect, it } from "vitest";
import { useUnmountObservable } from "./useUnmountObservable";

describe("useUnmountObservable", () => {
it("should not update source2 after unmounted", async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/shallowEqual.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, expect } from "vitest";
import { describe, expect, it } from "vitest";
import { shallowEqual } from "./shallowEqual";

describe("shallowEqual", () => {
Expand Down
Loading

0 comments on commit 7c26b27

Please sign in to comment.