1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

fix: bug with feature type matching

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
andreas-unleash 2023-10-04 14:50:48 +03:00
parent d5b4933df1
commit da0956b4d0
No known key found for this signature in database
GPG Key ID: DB82A1577B38F66B
2 changed files with 16 additions and 18 deletions

View File

@ -13,12 +13,11 @@ export const formatStatus = (
const { type, createdAt } = feature; const { type, createdAt } = feature;
const featureType = featureTypes.find( const featureType = featureTypes.find(
featureType => featureType.name === type featureType => featureType.id === type
); );
const date = parseISO(createdAt); const date = parseISO(createdAt);
const now = new Date(); const now = new Date();
const diff = getDiffInDays(date, now); const diff = getDiffInDays(date, now);
if ( if (
featureType && featureType &&
expired(diff, featureType) && expired(diff, featureType) &&

View File

@ -59,9 +59,9 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
); );
const { featureTypes } = useFeatureTypes(); const { featureTypes } = useFeatureTypes();
const data: IReportTableRow[] = useMemo<IReportTableRow[]>( const data: IReportTableRow[] = useMemo<IReportTableRow[]>(() => {
() => console.log(featureTypes);
features.map(report => ({ return features.map(report => ({
project: projectId, project: projectId,
name: report.name, name: report.name,
type: report.type, type: report.type,
@ -71,9 +71,8 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
lastSeenAt: report.lastSeenAt, lastSeenAt: report.lastSeenAt,
createdAt: report.createdAt, createdAt: report.createdAt,
expiredAt: formatExpiredAt(report, featureTypes), expiredAt: formatExpiredAt(report, featureTypes),
})), }));
[projectId, features] }, [projectId, features, featureTypes]);
);
const initialState = useMemo( const initialState = useMemo(
() => ({ () => ({
@ -145,7 +144,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
maxWidth: 120, maxWidth: 120,
}, },
], ],
[showEnvironmentLastSeen] [showEnvironmentLastSeen, JSON.stringify(data)]
); );
const { const {