Breaking: EmptyState no longer has a loading prop — show a Spinner while loading
@trackunit/react-components (from 7.0.0) removes the loading prop from EmptyState, with no compatibility shim. If any of your code passes loading to EmptyState, bumping the dependency is a compile failure, not a deprecation warning. Code that uses EmptyState without loading is unaffected.
There is no codemod for this change. Replace each usage by hand as shown below.
Why this changed
EmptyState with loading rendered a spinner plus a grey pulsing bar standing in for the description. The bar read as a stray line under the spinner, and it stood in for text that only appears if loading ends with nothing to show. An empty state now means one thing: loading has finished and there is no data.
The rule is:
- While loading, show a
Spinner, or a skeleton when the shape of the content is known. - Show
EmptyStateonly once loading has finished with nothing to show (no data, an error, not found, no access).
When it affects you
Nothing changes until you bump the package. At or above @trackunit/react-components 7.0.0, the prop is gone and any EmptyState that passes loading stops compiling until you change it.
// before
<EmptyState description={t("assets.empty")} loading={loading} />
// after
{loading ? <Spinner centering="centered" /> : <EmptyState description={t("assets.empty")} />}
What to do
- Pages and sections: render
<Spinner centering="centered" />while loading andEmptyStateafterwards, as above. - Tables: pass
loadingtoTableand keep the empty state in itsemptyStateprop withoutloading.Tableshows its own spinner while loading and only renders the empty state afterwards. - Loading text: if you passed a
descriptiononly to show text while loading, either drop it or pass it as theSpinnerlabel. - Layout: a spinner is smaller than an empty state. If the surrounding layout jumps when data arrives, give the spinner's container a fixed height with
containerClassName.
Spinner now has a default accessible name ("Loading", translated), so a plain spinner is announced by screen readers without any visible text.