Skip to content

Commit

Permalink
fix(flags): Fix spinner on new feature flag (#17953)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkakkar authored Oct 12, 2023
1 parent 36521eb commit d50eed9
Show file tree
Hide file tree
Showing 30 changed files with 9 additions and 3 deletions.
Binary file modified frontend/__snapshots__/lemon-ui-icons--shelf-n.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-experiments--experiments-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-insights--lifecycle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-insights--stickiness.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-number.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-insights--trends-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--bullet-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--empty-notebook.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--headings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--notebooks-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--numbered-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-notebooks--text-formats.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/scenes-app-surveys--survey-not-found.png
Binary file modified frontend/__snapshots__/scenes-app-surveys--survey-view.png
Binary file modified frontend/__snapshots__/scenes-app-surveys--surveys-list.png
3 changes: 2 additions & 1 deletion frontend/src/scenes/feature-flags/featureFlagLogic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ describe('the feature flag logic', () => {
logic.actions.setTotalUsers(100)
expect(logic.values.computeBlastRadiusPercentage(67, 0)).toBeCloseTo(67, 2)
// total users is defined but affected users is not. UI side should handle not showing the result in this case
expect(logic.values.computeBlastRadiusPercentage(75, 1)).toEqual(NaN)
// and computation resolves to rollout percentage
expect(logic.values.computeBlastRadiusPercentage(75, 1)).toEqual(75)
expect(logic.values.computeBlastRadiusPercentage(100, 2)).toBeCloseTo(25, 2)
})

Expand Down
9 changes: 7 additions & 2 deletions frontend/src/scenes/feature-flags/featureFlagLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
},
],
affectedUsers: [
{},
{ 0: -1 },
{
setAffectedUsers: (state, { index, count }) => ({
...state,
Expand Down Expand Up @@ -801,7 +801,12 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
effectiveRolloutPercentage = 100
}

if (affectedUsers[index] === -1 || totalUsers === -1 || !totalUsers) {
if (
affectedUsers[index] === -1 ||
totalUsers === -1 ||
!totalUsers ||
affectedUsers[index] === undefined
) {
return effectiveRolloutPercentage
}

Expand Down

0 comments on commit d50eed9

Please sign in to comment.