Open cpapazoglou opened 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.
Hey @cpapazoglou - I'm just going back through some older issues - wanted to see if this one is still relevant?
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 😅
Is your feature request related to a problem? Please describe.
import apiFetch from '@wordpress/api-fetch'
vsimport { apiFetch } from '@wordpress/data-controls'
is somehow confusing asapiFetch
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 firstapiFetch
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 ofapiFetch
for@wordpress/data-controls
would 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