Skip to content

Commit

Permalink
Remove MultiDimDataPage feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Feb 12, 2025
1 parent 04a5f0f commit db9b42e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 23 deletions.
9 changes: 1 addition & 8 deletions adminSiteServer/apiRoutes/mdims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import {
multiDimDataPageExists,
} from "../../db/model/MultiDimDataPage.js"
import { expectInt, isValidSlug } from "../../serverUtils/serverUtil.js"
import {
FEATURE_FLAGS,
FeatureFlagFeature,
} from "../../settings/clientSettings.js"
import {
upsertMultiDimConfig,
setMultiDimPublished,
Expand Down Expand Up @@ -71,10 +67,7 @@ export async function handlePutMultiDim(
const rawConfig = req.body as MultiDimDataPageConfigRaw
const id = await upsertMultiDimConfig(trx, slug, rawConfig)

if (
FEATURE_FLAGS.has(FeatureFlagFeature.MultiDimDataPage) &&
(await multiDimDataPageExists(trx, { slug, published: true }))
) {
if (await multiDimDataPageExists(trx, { slug, published: true })) {
await triggerStaticBuild(
res.locals.user,
`Publishing multidimensional chart ${slug}`
Expand Down
7 changes: 0 additions & 7 deletions baker/SiteBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ import { getAllImages } from "../db/model/Image.js"
import { generateEmbedSnippet } from "../site/viteUtils.js"
import { logErrorAndMaybeCaptureInSentry } from "../serverUtils/errorLog.js"
import { mapSlugsToConfigs } from "../db/model/Chart.js"
import { FeatureFlagFeature } from "../settings/clientSettings.js"
import pMap from "p-map"
import { GdocDataInsight } from "../db/model/Gdoc/GdocDataInsight.js"
import { calculateDataInsightIndexPageCount } from "../db/model/Gdoc/gdocUtils.js"
Expand Down Expand Up @@ -810,12 +809,6 @@ export class SiteBaker {

private async bakeMultiDimPages(knex: db.KnexReadonlyTransaction) {
if (!this.bakeSteps.has("multiDimPages")) return
if (!FEATURE_FLAGS.has(FeatureFlagFeature.MultiDimDataPage)) {
console.log(
"Skipping baking multi-dim pages because feature flag is not set"
)
return
}
const { imageMetadata } = await this.getPrefetchedGdocAttachments(knex)
await bakeAllMultiDimDataPages(knex, this.bakedSiteDir, imageMetadata)

Expand Down
21 changes: 13 additions & 8 deletions settings/clientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,21 @@ export const GDOCS_DETAILS_ON_DEMAND_ID: string =

export const PUBLISHED_AT_FORMAT = "ddd, MMM D, YYYY HH:mm"

// Feature flags: FEATURE_FLAGS is a comma-separated list of flags, and they need to be part of this enum to be considered
export enum FeatureFlagFeature {
MultiDimDataPage = "MultiDimDataPage",
}
/** A map of possible features which can be enabled or disabled. */
const Features = {
ExampleFeature: "ExampleFeature",
} as const

type Feature = (typeof Features)[keyof typeof Features]

// process.env.FEATURE_FLAGS is a comma-separated list of flags, and they need
// to be a valid value in the Features object to be considered.
const featureFlagsRaw =
(typeof process.env.FEATURE_FLAGS === "string" &&
process.env.FEATURE_FLAGS.trim()?.split(",")) ||
[]
export const FEATURE_FLAGS: Set<FeatureFlagFeature> = new Set(
Object.keys(FeatureFlagFeature).filter((key) =>
featureFlagsRaw.includes(key)
) as FeatureFlagFeature[]
export const FEATURE_FLAGS: Set<Feature> = new Set(
Object.values(Features).filter((feature) =>
featureFlagsRaw.includes(feature)
)
)

0 comments on commit db9b42e

Please sign in to comment.