react-client-sdk icon indicating copy to clipboard operation
react-client-sdk copied to clipboard

Registering 'error' event on ldClient does not suppress LaunchDarklyFlagFetchError

Open twillzy opened this issue 1 year ago • 0 comments

Describe the bug I have followed the instructions here to suppress LaunchDarklyFlagFetchError but I am still getting the error logged in the console (and hence, Sentry).

To reproduce

const App = (props) => {
  const ldClient = useLDClient();
  useEffect(() => {
    if (!ldClient) return;
    ldClient.on('error', (e): void => {
      /* do nothing */
    });
  }, [ldClient]);

  return (
      <>My App</>
  );
};

export default withLDProvider({clientSideID: 'xxx'})(App);

Expected behavior When ldClient encounters LaunchDarklyFlagFetchError in production, there should not be anything logged on console.

Logs If applicable, add any log output related to your problem.

SDK version "launchdarkly-react-client-sdk": "3.6.0",

twillzy avatar Dec 09 '24 17:12 twillzy