WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.4k stars 4.15k forks source link

Change the name of apiFetch of @wordpress/data-controls as it is the same with apiFetch of @wordpress/apiFetch #22252

Open cpapazoglou opened 4 years ago

cpapazoglou commented 4 years ago

Is your feature request related to a problem? Please describe. import apiFetch from '@wordpress/api-fetch' vs import { apiFetch } from '@wordpress/data-controls' is somehow confusing as apiFetch seems to be (from naming) the same but the first is actually a wrapper of fetch() (that's cool) while the second is an action generator that eventually uses the first apiFetch so we can handle async calls in stores! Even if someone reads the documentation for both @wordpress/data-controls (https://github.com/WordPress/gutenberg/tree/master/packages/data-controls#apiFetch) and @wordpress/apiFetch (https://github.com/WordPress/gutenberg/tree/master/packages/api-fetch#options) it is very counter intuitive the first time.

Describe the solution you'd like Maybe using apiFetchGenerator instead of apiFetch for @wordpress/data-controlswould be more suitable? Can we alias and deprecate the old name so that we don't introduce a breaking change?

Describe alternatives you've considered As an alternative, we can update our documentation for both packages warning the user that this two functions are actually very different

chrisvanpatten commented 4 years ago

I actually have read the data-controls docs several times and I don't think I picked up on the distinction either. I agree, and if there are backcompat concerns around changing the name a documentation change would be great.

jordesign commented 1 year ago

Hey @cpapazoglou - I'm just going back through some older issues - wanted to see if this one is still relevant?

cpapazoglou commented 1 year ago

Hey @cpapazoglou - I'm just going back through some older issues - wanted to see if this one is still relevant?

Yeah, the confusion still stands. Although, I haven't used any of them since then 😅