App behaves differently after expo-publish

Hi,

I have a question. I used the code below to fetch data from an API using async dispatch. It works great when in development mode but not after expo publish. It’s really weird, it gives no error. The issue isn’t with the fetch logic because I can just console.log the fetched data within the component. Whatever I try the fetched data isn’t visible.

const HomeScreen = props => {
    const [error, setError] = useState();
    const [isLoading, setIsLoading] = useState(false);
   
 
    const userInfo = useSelector(state => state.userdata);
 
    const dispatch = useDispatch();
 
    const loadData = useCallback(async () => {
        setError(null);
        try {
            await dispatch(userActions.fetchData());
        } catch (err) {
            setError(err.message)
        }
    }, [dispatch, setError]);
 
 
    useEffect(() => {
        const willFocusSub = props.navigation.addListener('willFocus', loadData)
 
       return () => {
           willFocusSub.remove();
       };
   }, [loadData])
 
   useEffect(() => {
    setIsLoading(true);
    loadData().then(() => {
        setIsLoading(false);
    });
    }, [dispatch, loadData])
 
 
    if (isLoading) {
        return (
        <View style={styles.activityIndicator}>
            <ActivityIndicator size='large' color={'black'} />
        </View>)
    }
 
 
    return (<View>
       .....
    )
};

After fetching data it fills in the form with the data. User can change it after that and submit. I removed al the form input validation and any other code. Is there something wrong with my code or is this a bug? Please tell me if you need more info.

Expo CLI 3.21.3 environment info:
System:
OS: Windows 10 10.0.18362
Binaries:
Node: 14.2.0 - C:\Program Files\nodejs\node.EXE
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135
npmPackages:
expo: ~38.0.8 => 38.0.10
react: ~16.11.0 => 16.11.0
react-dom: ~16.11.0 => 16.11.0
react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2
react-native-web: ~0.11.7 => 0.11.7
react-navigation: ^4.4.0 => 4.4.0

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.