toss / suspensive

Manage asynchronous operations, timing, error handling, detecting intersection of elements, and caching easily and declaratively
https://suspensive.org
MIT License
508 stars 48 forks source link

[Feature]: More description for target version #1000

Closed manudeli closed 3 months ago

manudeli commented 3 months ago

Package Scope

@suspensive/react-query

Bug description

image

issued by @juno7803

Expected behavior

No response

To Reproduce

No response

Possible Solution

No response

etc.

No response

manudeli commented 3 months ago

@juno7803 Could you add what you expect as Pull Request?

juno7803 commented 3 months ago

I believe that the cli for @suspensive/react-query status clearly supports different versions of react-query for users.

However, despite its clear functionality, I find the guidance provided by the CLI to be unclear. If it's alright with you, could I contribute by submitting a Pull Request? 😁

gwansikk commented 3 months ago

I believe that the cli for @suspensive/react-query status clearly supports different versions of react-query for users.

However, despite its clear functionality, I find the guidance provided by the CLI to be unclear. If it's alright with you, could I contribute by submitting a Pull Request? 😁

@juno7803 I agree, especially the (5) in [@suspensive/react-query] v2.3.0 (5) is not clear. It is difficult for users to understand what it means. Please revise it to provide sufficient guidance from the user's perspective.

manudeli commented 3 months ago

Suggestion

I made example what I expected. When I use suspensive-react-query status, I felt that I want to know what interface will be exported by each packages(@suspensive/react-query, @tanstack/react-query)

Suspensive React Query with TanStack Query v4

Suspensive React Query status:
@suspensive/react-query@2.3.0 export @suspensive/react-query-4's interfaces
  - useSuspenseQuery
  - useSuspenseQueries
  - useSuspenseInfiniteQuery
  - queryOptions
  - SuspenseQuery
  - SuspenseQueries
  - SuspenseInfiniteQuery
  - QueryErrorBoundary
@tanstack/react-query@4.36.2
  - all interfaces

Suspensive React Query with TanStack Query v5

Suspensive React Query status:
@suspensive/react-query@2.3.0 export @suspensive/react-query-5's interfaces
  - SuspenseQuery
  - SuspenseQueries
  - SuspenseInfiniteQuery
  - QueryErrorBoundary
@tanstack/react-query@5.32.0
  - useSuspenseQuery
  - useSuspenseQueries
  - useSuspenseInfiniteQuery
  - queryOptions
  - all interfaces

If you have better Idea, Suggest example before developing please! @juno7803 @gwansikk

gwansikk commented 3 months ago

@juno7803 @manudeli

https://github.com/toss/suspensive/issues/1000#issuecomment-2196488181

Oh, this is really detailed and impressive.

How about including a link to the official documentation for information about the interfaces?

manudeli commented 3 months ago

How about including a link to the official documentation for information about the interfaces?

In my opinion, Linking official doc is not good idea to expose what exactly dist/index.js export at each version because official doc only expose latest public apis

So In my opinion, to implement detailed suspensive-react-query status Parsing dist/index.js of @suspensive/react-query's exposing package(@suspensive/react-query-4, @suspensive/react-query-5) is good way to expose public apis of each version

However, displaying the list of interfaces might reduce readability if more interfaces are added in the future.

I agree with your opinion, then how about showing public apis of @suspensive/react-query only, not @tanstack/react-query

Suspensive React Query with TanStack Query v4

Suspensive React Query status:
@suspensive/react-query@2.3.0 export @suspensive/react-query-4's interfaces
  - useSuspenseQuery
  - useSuspenseQueries
  - useSuspenseInfiniteQuery
  - queryOptions
  - SuspenseQuery
  - SuspenseQueries
  - SuspenseInfiniteQuery
  - QueryErrorBoundary
@tanstack/react-query@4.36.2

Suspensive React Query with TanStack Query v5

Suspensive React Query status:
@suspensive/react-query@2.3.0 export @suspensive/react-query-5's interfaces
  - SuspenseQuery
  - SuspenseQueries
  - SuspenseInfiniteQuery
  - QueryErrorBoundary
@tanstack/react-query@5.32.0
gwansikk commented 3 months ago

So In my opinion, to implement detailed suspensive-react-query status Parsing dist/index.js of @suspensive/react-query's exposing package(@suspensive/react-query-4, @suspensive/react-query-5) is good way to expose public apis of each version

@manudeli I agree with your opinion! Is the method you explained the same as the one written below? Do we provide API information by branching according to the version, or do we dynamically display the code exported by dist/index.cjs using TypeScript AST?

if (suspensiveReactQueryVersion === '5') {
  console.log(`
- SuspenseQuery
- SuspenseQueries
- SuspenseInfiniteQuery
- QueryErrorBoundary`)
} else if (suspensiveReactQueryVersion === '4') {
  console.log(`
- useSuspenseQuery
- useSuspenseQueries
- useSuspenseInfiniteQuery
- queryOptions
- SuspenseQuery
- SuspenseQueries
- SuspenseInfiniteQuery
- QueryErrorBoundary`)
}
manudeli commented 3 months ago

@gwansikk

Do we provide API information by branching according to the version, or do we dynamically display the code exported by dist/index.cjs using TypeScript AST?

In my opinion, display dynamically finally is better for me. but if we need to resolve this issue first, I think that displaying public apis by branching according to the version statically will be good solution at this first time!

Fast resolve issue, and improving feature gradually also good!

@juno7803 How do you think of this way?

juno7803 commented 3 months ago

You guys shared a lot of valuable opinions! Thank you so much, and I apologize for the delay.

The biggest inconvenience from the user's perspective was understanding what CLI were trying to convey. Therefore, assuming you know the following key features of @suspensive/react-query, it was suggested to show what CLI status supports:

At first, instead of specifying which APIs are provided when using with @tanstack/react-query v4 and which are provided when using with @tanstack/react-query v5, I thought to be sufficient to simply state that v4 provides v5 features and that when upgrading to v5, redundant APIs are maintained as singletons, @suspensive/react-query only exporting what is necessary.

However, after reading the new issue comments, I think it's best to be clear as @manudeli mentioned. (Upon reflection, I realize I have some background knowledge from @manudeli 's explanations of the library concept). While I completely agree with @gwansikk's opinion on readability and maintainability, providing document links is also part of maintainability, but personally, I don't prefer navigating through multiple layers (I think that might feel like depth to some people.), especially in CLI.

Therefore, as @manudeli suggested, I think it's best to first resolve the issue by displaying it statically and then improve it through automation. As for how to automate, I might need to study more to contribute as much as those who developed it..!

Thank you once again for sharing your valuable opinions! ❤️