Skip to content

Commit

Permalink
fix: Associated segment overrides (#2582)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Aug 8, 2023
1 parent 8d8ec93 commit 707d394
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions frontend/common/providers/withSegmentOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export default (WrappedComponent) => {
this.getOverrides()
}

componentDidUpdate(prevProps, prevState, snapshot) {
if (prevProps.environmentId !== this.props.environmentId) {
this.getOverrides()
}
}

getOverrides = () => {
if (this.props.projectFlag) {
Promise.all([
Expand Down
9 changes: 4 additions & 5 deletions frontend/web/components/SegmentOverrides.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import propTypes from 'prop-types';
import React, { Component } from 'react'
import React, { Component, Fragment } from 'react';
import { SortableContainer, SortableElement } from 'react-sortable-hoc'
import ProjectStore from 'common/stores/project-store'
import ValueEditor from './ValueEditor'
Expand Down Expand Up @@ -183,7 +183,7 @@ const SegmentOverrideInner = class Override extends React.Component {
className='ml-2 dark-link'
>
Edit Segment
<ion className={'ion ml-1 ion-md-open'} />
<i className={'ion ml-1 ion-md-open'} />
</Button>
)}
</>,
Expand Down Expand Up @@ -333,7 +333,7 @@ const SegmentOverrideListInner = ({
return (
<div>
{items.map((value, index) => (
<>
<Fragment key={value.segment.name}>
<InnerComponent
id={id}
name={name}
Expand All @@ -344,7 +344,6 @@ const SegmentOverrideListInner = ({
environmentId={environmentId}
projectId={projectId}
multivariateOptions={multivariateOptions}
key={value.segment.name}
index={index}
readOnly={readOnly}
value={value}
Expand Down Expand Up @@ -372,7 +371,7 @@ const SegmentOverrideListInner = ({
json={value}
/>
</div>
</>
</Fragment>
))}
</div>
)
Expand Down

3 comments on commit 707d394

@vercel
Copy link

@vercel vercel bot commented on 707d394 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

docs – ./docs

docs-git-main-flagsmith.vercel.app
docs.flagsmith.com
docs-flagsmith.vercel.app
docs.bullet-train.io

@vercel
Copy link

@vercel vercel bot commented on 707d394 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 707d394 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.