Skip to content

Commit

Permalink
fix: Disable segment override diffs for non versioned environments (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored May 10, 2024
1 parent 99de926 commit e5b4313
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions frontend/web/components/diff/DiffChangeRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ type DiffChangeRequestType = {
changeRequest: ChangeRequest | null
feature: number
projectId: string
isVersioned: boolean
}

const DiffChangeRequest: FC<DiffChangeRequestType> = ({
changeRequest,
feature,
isVersioned,
projectId,
}) => {
const { data, isLoading } = useGetFeatureStatesQuery(
Expand All @@ -36,6 +38,7 @@ const DiffChangeRequest: FC<DiffChangeRequestType> = ({
<div className='col-md-8'>
<DiffFeature
featureId={feature}
disableSegments={!isVersioned}
projectId={projectId}
newState={changeRequest.feature_states}
oldState={data?.results || []}
Expand Down
6 changes: 5 additions & 1 deletion frontend/web/components/diff/DiffFeature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ type FeatureDiffType = {
featureId: number
projectId: string
tabTheme?: string
disableSegments?: boolean
}

const DiffFeature: FC<FeatureDiffType> = ({
disableSegments,
featureId,
newState,
noChangesMessage,
Expand All @@ -47,7 +49,9 @@ const DiffFeature: FC<FeatureDiffType> = ({
projectId,
})

const segmentDiffs = getSegmentDiff(oldState, newState, segments?.results)
const segmentDiffs = disableSegments
? { diffs: [], totalChanges: 0 }
: getSegmentDiff(oldState, newState, segments?.results)
const variationDiffs = getVariationDiff(oldEnv, newEnv, feature)
const totalSegmentChanges = segmentDiffs?.totalChanges
const totalVariationChanges = variationDiffs?.totalChanges
Expand Down
1 change: 1 addition & 0 deletions frontend/web/components/pages/ChangeRequestPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ const ChangeRequestsPage = class extends Component {
</div>
</Panel>
<DiffChangeRequest
isVersioned={isVersioned}
changeRequest={changeRequest}
feature={projectFlag.id}
projectId={this.props.match.params.projectId}
Expand Down

0 comments on commit e5b4313

Please sign in to comment.