suddjian edited a comment on pull request #13218:
URL: https://github.com/apache/superset/pull/13218#issuecomment-783750446


   > I do, however, believe there's value in hiding API endpoints and 
pre-defined transformations from end users and have a centralized, strongly 
typed API catalog like 
[this](https://github.com/apache-superset/superset-ui/blob/d985ba3711363054662317c87fe64924091db5fb/packages/superset-ui-core/src/query/api/v1/index.ts#L27).
   > 
   > `makeApi` naturally supports this, while the composable hooks approach may 
lead to more fragmentary code. There are also places where a general async 
function would be preferred, because hooks can only be used in functional 
components.
   
   I like the catalog idea! That is very much compatible with this work. I'll 
add something like that for these hooks as well.
   
   Almost all new frontend code is being written with function components, with 
some efforts underway to convert class components to functions, and it is also 
quite easy to write a HOC to patch in hook functionality to class components if 
needed, so relying on hooks for this sort of logic doesn't bother me at all. 
I'm actually pretty excited about the possibilities there.
   
   > For now, this is probably good enough for Superset, but if we are thinking 
of getting fancy with deduplication and caching by entity, I would also like to 
see us evaluating some existing solutions out there such as [REST 
Hooks](https://resthooks.io/docs/api/README) before committing to create our 
own solution for things like shared storage.
   
   This is my first time reading about the REST hooks library, looks like a 
great option! I agree that we should wait to review it until we want to get 
fancy. Looks like it adds a few new abstractions, which may or may not be right 
for us when we reach that point. The hooks I've written here have a very simple 
interface so they should be easy to replace with a library later if we want to.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to