Hello everyone, I was wondering if there any way t...
# ask-questions
j
Hello everyone, I was wondering if there any way to refresh experiment variations when the attributes are updated.
Copy code
const gb = useGrowthBook();

  // Set Attribute
  const { user, isAuthenticating } = useAuthStateProvider();
  const deviceId = getDeviceId();
  const { isMobile } = useScreen();

  useEffect(() => {
    (async () => {
      if (isAuthenticating) return;

      gb.updateAttributes({
        userId: user?.id ?? "-1",
        deviceId,
        isMobile,
      });
      try {
        const ip = await getIp();
        gb.updateAttributes({ ip });
      } catch {}
    })();
  }, [user, deviceId, isMobile, gb, isAuthenticating]);
I use React SDK in my Next.js project. When I update the attributes, I checked experiments through GrowthBook devtool and found out the experiment variation didn't update.
f
It should update features/experiment values when attributes change
I wonder if it’s a problem with the devtools
Is update attributes your method?
j
Thanks for your reply. I use the native growthbook react hook
Copy code
import { useGrowthBook } from "@growthbook/growthbook-react";

const gb = useGrowthBook();

gb.updateAttributes({
        userId: user?.id ?? "-1",
        deviceId,
        isMobile,
      });
How can I check if it's something wrong with the devtool? Will
trackingCallback
be called if there is any experiment is updated?
I think I misunderstood the
trackingCallback
meaning. Actually, the experiment's variation was updated, but I thought as soon as the variation is updated,
trackingCallback
will be called again.