|
@@ -1,7 +1,6 @@
|
|
import { createSelector } from 'reselect';
|
|
import { createSelector } from 'reselect';
|
|
import { RootState, SchemasState } from 'redux/interfaces';
|
|
import { RootState, SchemasState } from 'redux/interfaces';
|
|
import { createFetchingSelector } from 'redux/reducers/loader/selectors';
|
|
import { createFetchingSelector } from 'redux/reducers/loader/selectors';
|
|
-import { SchemaSubject } from 'generated-sources';
|
|
|
|
|
|
|
|
const schemasState = ({ schemas }: RootState): SchemasState => schemas;
|
|
const schemasState = ({ schemas }: RootState): SchemasState => schemas;
|
|
|
|
|
|
@@ -30,12 +29,8 @@ export const getSchemaList = createSelector(
|
|
getIsSchemaListFetched,
|
|
getIsSchemaListFetched,
|
|
getAllNames,
|
|
getAllNames,
|
|
getSchemaMap,
|
|
getSchemaMap,
|
|
- (isFetched, allNames, byName) => {
|
|
|
|
- if (!isFetched) {
|
|
|
|
- return [];
|
|
|
|
- }
|
|
|
|
- return allNames.map((subject) => byName[subject as string]);
|
|
|
|
- }
|
|
|
|
|
|
+ (isFetched, allNames, byName) =>
|
|
|
|
+ isFetched ? allNames.map((subject) => byName[subject]) : []
|
|
);
|
|
);
|
|
|
|
|
|
const getSchemaName = (_: RootState, subject: string) => subject;
|
|
const getSchemaName = (_: RootState, subject: string) => subject;
|
|
@@ -46,10 +41,8 @@ export const getSchema = createSelector(
|
|
(schemas, subject) => schemas[subject]
|
|
(schemas, subject) => schemas[subject]
|
|
);
|
|
);
|
|
|
|
|
|
-export const getSchemaVersions = createSelector(
|
|
|
|
|
|
+export const getSortedSchemaVersions = createSelector(
|
|
schemasState,
|
|
schemasState,
|
|
({ currentSchemaVersions }) =>
|
|
({ currentSchemaVersions }) =>
|
|
- currentSchemaVersions.sort(
|
|
|
|
- (a: SchemaSubject, b: SchemaSubject) => a.id - b.id
|
|
|
|
- )
|
|
|
|
|
|
+ currentSchemaVersions.sort((a, b) => a.id - b.id)
|
|
);
|
|
);
|