Skip to content

Commit

Permalink
fix: Incorrect tag filtering when results have no features (#3309)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg committed Jan 23, 2024
1 parent ec272ba commit cca86c3
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frontend/web/components/pages/FeaturesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const FeaturesPage = class extends Component {
constructor(props, context) {
super(props, context)
this.state = {
loadedOnce: false,
search: null,
showArchived: false,
sort: { label: 'Name', sortBy: 'name', sortOrder: 'asc' },
Expand Down Expand Up @@ -61,6 +62,7 @@ const FeaturesPage = class extends Component {
params.environmentId !== oldParams.environmentId ||
params.projectId !== oldParams.projectId
) {
this.state.loadedOnce = false
AppActions.getFeatures(
params.projectId,
params.environmentId,
Expand Down Expand Up @@ -181,16 +183,19 @@ const FeaturesPage = class extends Component {
totalFeatures,
maxFeaturesAllowed,
)
if (projectFlags?.length && !this.state.loadedOnce) {
this.state.loadedOnce = true
}
return (
<div className='features-page'>
{isLoading && (!projectFlags || !projectFlags.length) && (
<div className='centered-container'>
<Loader />
</div>
)}
{(!isLoading || (projectFlags && !!projectFlags.length)) && (
{(!isLoading || this.state.loadedOnce) && (
<div>
{(projectFlags && projectFlags.length) ||
{this.state.loadedOnce ||
((this.state.showArchived ||
typeof this.state.search === 'string' ||
!!this.state.tags.length) &&
Expand All @@ -205,7 +210,7 @@ const FeaturesPage = class extends Component {
title={'Features'}
cta={
<>
{(projectFlags && projectFlags.length) ||
{this.state.loadedOnce ||
this.state.showArchived ||
this.state.tags?.length
? this.createFeaturePermission((perm) => (
Expand Down Expand Up @@ -483,9 +488,7 @@ const FeaturesPage = class extends Component {
title='2: Initialising your project'
snippets={Constants.codeHelp.INIT(
this.props.match.params.environmentId,
projectFlags &&
projectFlags[0] &&
projectFlags[0].name,
projectFlags?.[0]?.name,
)}
/>
</FormGroup>
Expand Down

3 comments on commit cca86c3

@vercel
Copy link

@vercel vercel bot commented on cca86c3 Jan 23, 2024

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 cca86c3 Jan 23, 2024

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.bullet-train.io
docs.flagsmith.com
docs-flagsmith.vercel.app

@vercel
Copy link

@vercel vercel bot commented on cca86c3 Jan 23, 2024

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.