Hi! I am having issues overriding Feature/Experime...
# ask-questions
g
Hi! I am having issues overriding Feature/Experiment rules using the Chrome DevTool. The DevTool loads and displays the correct features and experiments with correct split and assigned variations etc. My issue is that when I try to override the variation using the DevTool I see no changes in my UI. Shouldn't the devtool be able to force certain variations so I can see & test without custom force-rules or clearing cookies and hope I get lucky? Or is there any special setup I need to do with the SDK apart for setting
enableDevMode: true
(which obviously works since I can see the DevTool)? Thanks!
👀 1
Some more context: I'm using the React SDK with a Hybrid (SSR + Client-side) approach. I also have
backgroundSync: false
if that maybe makes a difference
To be clear I expect clicking and forcing the variation to
false
updates the UI in the button affected by the experiment (text should then say
disabled
)
Screenshot 2023-09-11 at 13.16.19.png
b
@gorgeous-translator-85551 Sorry to hear you're having trouble. I feel like I recall someone else running into this, and with their setup, once they toggled the value in the DevTool, a page refresh rendered the correct variation. I take it that doesn't work in this situation?
g
Aha, yes reloading the page does not help unfortunately 🤔
b
@gorgeous-translator-85551 A few things to check: 1. Do you have a single GrowthBook instance on the client-side? DevTools can't attach to multiple instances, so if you have more than 1, it won't work properly 2. Are you creating the GrowthBook instance once (e.g. outside the component or within a useMemo/useRef/useState hook)? If creating a new instance every render, the DevTools might not work properly 3. Are you wrapping the app in the
<GrowthBookProvider>
component? If not, DevTools won't be able to re-render their app when you click variations
g
Thank you for the suggestions! I'm using
useRef
when creating the GrowthBook instance so it should one exist one as far as I know. The component in question is also wrapped (the whole app is actually) in a
<GrowthBookProvider>
Don't know if this i helpful but when inspecting the DevTools themselves i see this error occur when changing variation:
Copy code
devtools_panel.html:1 Error handling response: TypeError: Cannot read properties of undefined (reading 'id')
    at <chrome-extension://opemhndcehfgipokneipaafbglcecjia/js/devtools_panel.js:2:1194187>
b
Hmm... I think it might have to do with the
useRef
hook since changing a ref doesn't trigger a re-render.