Skip to content

Registering 'error' event on ldClient does not suppress LaunchDarklyFlagFetchError #337

@twillzy

Description

@twillzy

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",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions