React app, app is loading

hey everyone!
We have a problem with custom React app in Freshservice that says app is loading… in Chrome browser but in Firefox browser works perfectly. the app does exactly the same thing both in Dev environment and installed.

App.js :

import React, { useState, useEffect } from 'react';
import './App.css';
import MainComponent from './components/MainComponent';

const App = () => {
  const [loaded, setLoaded] = useState(false);
  const [child, setChild] = useState(<h3>App is loading...</h3>);

  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://static.freshdev.io/fdk/2.0/assets/fresh_client.js';
    script.addEventListener('load', () => setLoaded(true));
    script.defer = true;
    document.head.appendChild(script);
  }, []);

  useEffect(() => {
    if (!loaded) return;
    app.initialized().then((client) => {
      setChild(<MainComponent client={client} />);
    });
  }, [loaded]);

  return <div>{child}</div>;
};
export default App;

logs in Chrome browser:

Hi @Nasir_Haidari ,

Can you please try the suggestions given in the below thread & confirm if it’s resolving your issue as well?

Thanks

1 Like

Thanks @mariappan !
It worked perfectly! :star_struck: :clap:

Regards, Nasir Haidari