Skip to content

Commit

Permalink
Ensure the <LogStream /> component reacts to query changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Jun 30, 2021
1 parent 1d02a0d commit 218cc44
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ export function useLogStream({
const prevStartTimestamp = usePrevious(startTimestamp);
const prevEndTimestamp = usePrevious(endTimestamp);

const cachedQuery = useRef(query);

const [cachedQuery, setCachedQuery] = useState(query);
if (!isEqual(query, cachedQuery)) {
cachedQuery.current = query;
setCachedQuery(query);
}

useEffect(() => {
Expand All @@ -89,7 +88,7 @@ export function useLogStream({
sourceId,
startTimestamp,
endTimestamp,
query: cachedQuery.current,
query: cachedQuery,
columnOverrides: columns,
}),
[columns, endTimestamp, cachedQuery, sourceId, startTimestamp]
Expand Down

0 comments on commit 218cc44

Please sign in to comment.