Skip to content

Commit

Permalink
fix(tokens): add observable dependency to token resolver instead of c…
Browse files Browse the repository at this point in the history
…allback

GitOrigin-RevId: e512f2b78f896a74c3f299e3b33827366ec6814b
  • Loading branch information
IcaroG authored and actions-user committed Nov 14, 2024
1 parent fe5d56f commit ace4a78
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
makeTokenResolver,
} from "@/wab/shared/cached-selectors";
import { StyleToken } from "@/wab/shared/model/classes";
import * as React from "react";

const RE_VARIABLE_REF = /var\((--[^)]+)\)/;

Expand All @@ -30,10 +29,9 @@ const RE_VARIABLE_REF = /var\((--[^)]+)\)/;
export function useClientTokenResolver(): TokenValueResolver {
const sc = useStudioCtx();
const vc = sc.focusedViewCtx();

const resolver = React.useCallback(makeTokenResolver(sc.site), [
vc?.isFirstRenderComplete,
]);
// depend on first render observable
vc?.isFirstRenderComplete;
const resolver = makeTokenResolver(sc.site);
return makeClientTokenResolver(resolver, vc ?? sc);
}

Expand Down

0 comments on commit ace4a78

Please sign in to comment.