Skip to content

Commit

Permalink
catalog-react: deprecate EntityContext and add AsyncEntityProvider
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
  • Loading branch information
Rugvip committed Sep 11, 2021
1 parent 10e3c97 commit ea81a1f
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 131 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-drinks-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': patch
---

Deprecated EntityContext in favor of using `useEntity`, `EntityProvider` and the new `AsyncEntityProvider` instead. This update also brings cross-version compatibility to `@backstage/catalog-react`, meaning that future versions can be used in parallel with this one.
41 changes: 33 additions & 8 deletions plugins/catalog-react/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,29 @@ import { SystemEntity } from '@backstage/catalog-model';
import { TableColumn } from '@backstage/core-components';
import { UserEntity } from '@backstage/catalog-model';

// @public
export const AsyncEntityProvider: ({
children,
entity,
loading,
error,
refresh,
}: AsyncEntityProviderProps) => JSX.Element;

// @public
export interface AsyncEntityProviderProps {
// (undocumented)
children: ReactNode;
// (undocumented)
entity?: Entity;
// (undocumented)
error?: Error;
// (undocumented)
loading: boolean;
// (undocumented)
refresh?: VoidFunction;
}

export { CATALOG_FILTER_EXISTS };

export { CatalogApi };
Expand Down Expand Up @@ -109,9 +132,8 @@ export type DefaultEntityFilters = {
};

// Warning: (ae-forgotten-export) The symbol "EntityLoadingStatus" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityContext" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public @deprecated (undocumented)
export const EntityContext: Context<EntityLoadingStatus>;

// Warning: (ae-missing-release-tag) "EntityFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Expand Down Expand Up @@ -199,15 +221,20 @@ export class EntityOwnerFilter implements EntityFilter {
// @public (undocumented)
export const EntityOwnerPicker: () => JSX.Element | null;

// Warning: (ae-forgotten-export) The symbol "EntityProviderProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityProvider" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const EntityProvider: ({
entity,
children,
}: EntityProviderProps) => JSX.Element;

// @public
export interface EntityProviderProps {
// (undocumented)
children: ReactNode;
// (undocumented)
entity?: Entity;
}

// Warning: (ae-forgotten-export) The symbol "EntityRefLinkProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityRefLink" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down Expand Up @@ -726,8 +753,6 @@ export const UnregisterEntityDialog: ({
entity,
}: Props_3) => JSX.Element;

// Warning: (ae-missing-release-tag) "useEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export function useEntity<T extends Entity = Entity>(): {
entity: T;
Expand Down
1 change: 1 addition & 0 deletions plugins/catalog-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@backstage/core-components": "^0.4.0",
"@backstage/core-plugin-api": "^0.1.6",
"@backstage/integration": "^0.6.3",
"@backstage/version-bridge": "^0.1.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "4.0.0-alpha.45",
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions plugins/catalog-react/src/components/EntityProvider/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion plugins/catalog-react/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
export * from './EntityKindPicker';
export * from './EntityLifecyclePicker';
export * from './EntityOwnerPicker';
export * from './EntityProvider';
export * from './EntityRefLink';
export * from './EntitySearchBar';
export * from './EntityTable';
Expand Down
12 changes: 11 additions & 1 deletion plugins/catalog-react/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { EntityContext, useEntity, useEntityFromUrl } from './useEntity';
export {
EntityContext,
useEntity,
useEntityFromUrl,
EntityProvider,
AsyncEntityProvider,
} from './useEntity';
export type {
EntityProviderProps,
AsyncEntityProviderProps,
} from './useEntity';
export { useEntityCompoundName } from './useEntityCompoundName';
export {
EntityListContext,
Expand Down
70 changes: 0 additions & 70 deletions plugins/catalog-react/src/hooks/useEntity.ts

This file was deleted.

0 comments on commit ea81a1f

Please sign in to comment.