Skip to content

Commit 4364a3d

Browse files
committed
docs: make warning more obvious
1 parent 81a723a commit 4364a3d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

site/src/modules/resources/AgentMetadata.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ export const AgentMetadata: FC<AgentMetadataProps> = ({
5353
}) => {
5454
const [activeMetadata, setActiveMetadata] = useState(storybookMetadata);
5555
useEffect(() => {
56+
// This is an unfortunate pitfall with this component's testing setup,
57+
// but even though we use the value of storybookMetadata as the initial
58+
// value of the activeMetadata, we cannot put activeMetadata itself into
59+
// the dependency array. If we did, we would destroy and rebuild each
60+
// connection every single time a new message comes in from the socket,
61+
// because the socket has to be wired up to the state setter
5662
if (storybookMetadata !== undefined) {
5763
return;
5864
}
@@ -108,13 +114,6 @@ export const AgentMetadata: FC<AgentMetadataProps> = ({
108114
window.clearTimeout(timeoutId);
109115
latestSocket?.close();
110116
};
111-
112-
// This is an unfortunate pitfall with this component's testing setup,
113-
// but even though we use the value of storybookMetadata as the initial
114-
// value of the activeMetadata, we cannot put activeMetadata itself into
115-
// the dependency array. If we did, we would destroy and rebuild each
116-
// connection every single time a new message comes in from the socket,
117-
// because the socket has to be wired up to the state setter
118117
}, [agent.id, storybookMetadata]);
119118

120119
if (activeMetadata === undefined) {

0 commit comments

Comments
 (0)