useEffect(() => {
if (!symbol) {
return;
}
const nextInstrumentName =
instrumentName?.trim() || undefined;
const nextInstrumentTicker =
instrumentTicker?.trim() || undefined;
const symbolChanged =
currentSymbolRef.current !== symbol;
const instrumentNameChanged =
currentInstrumentNameRef.current !==
nextInstrumentName;
const instrumentTickerChanged =
currentInstrumentTickerRef.current !==
nextInstrumentTicker;
if (
!symbolChanged &&
!instrumentNameChanged &&
!instrumentTickerChanged
) {
return;
}
currentSymbolRef.current = symbol;
currentInstrumentNameRef.current =
nextInstrumentName;
currentInstrumentTickerRef.current =
nextInstrumentTicker;
chartRef.current?.setSymbol(
symbol,
nextInstrumentName,
nextInstrumentTicker,
);
}, [
symbol,
instrumentName,
instrumentTicker,
]);