Skip to content

Instantly share code, notes, and snippets.

@insin
Created August 13, 2025 18:13
Show Gist options
  • Save insin/48ad60824dcf85e4d72eb1e3a1819831 to your computer and use it in GitHub Desktop.
Save insin/48ad60824dcf85e4d72eb1e3a1819831 to your computer and use it in GitHub Desktop.
Disable a feature flag on Twitter
let $reactRoot = document.querySelector('#react-root')
let wrapped = $reactRoot.firstElementChild.wrappedJSObject || $reactRoot.firstElementChild
let reactPropsKey = Object.keys(wrapped).find(key => key.startsWith('__reactProps'))
let featureSwitches = wrapped[reactPropsKey].children?.props?.children?.props?.contextProviderProps?.featureSwitches
let isTrue = featureSwitches.isTrue
featureSwitches.isTrue = (flag) => {
if (flag == 'rweb_age_assurance_flow_enabled') return false
return isTrue(flag)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment