Fetch not defined

when i update fuse from version 27 to version 29! i got this error !

Source line: fetch (“https://news.placeholder.tn/highteck.json”)
JS stack trace: ReferenceError: fetch is not defined
at reloadHandler (Pages/HomePage.js:21:5)
at null._tempMethod (Pages/HomePage.js:43:1)
in Fuse.Reactive.JavaScript</usr/local/share/uno/Packages/Fuse.Reactive/0.40.8/$.uno:1445>

Did you remember to clean the project after updating?

Yes! i did.
But i got the same error! can you give you the whole project by mail ?

A small reproduction of the issue, posted here in the forum, would be much better than everything :slight_smile:

Have you checked whether the problem persists if you start a new project using fetch?

my code :

var Observable = require("FuseJS/Observable");
var Bundle = require("FuseJS/Bundle");
var Lifecycle = require("FuseJS/Lifecycle");
             var dataTech = Observable();            
             var dataSports = Observable();  
             var dataPolitics = Observable();
             var dataEconomie = Observable();
             var isLoading =Observable();
             var imageFull = Observable();
function endLoading(){
        isLoading.value = false;
    }
function reloadHandler(){

     fetch('https://news.placeholder.tn/highteck.json')
            .then(function(response) { return response.json(); })
            .then(function(responseObject) { dataTech.value = responseObject; });

                   fetch('https://news.placeholder.tn/sport.json')
            .then(function(response) { return response.json(); })
            .then(function(responseObject) { dataSports.value = responseObject; });

                fetch('https://news.placeholder.tn/politique.json')
            .then(function(response) { return response.json(); })
            .then(function(responseObject) { dataPolitics.value = responseObject; });
                

                fetch('https://news.placeholder.tn/economie.json')
            .then(function(response) { return response.json(); })
            .then(function(responseObject) { dataEconomie.value = responseObject; });


        isLoading.value = true;
       
    }

reloadHandler();


var hikes = dataTech;
var hikesSports = dataSports;
var hikesPolitics = dataPolitics;
var hikesEconomie= dataEconomie;
function goToHike(arg) {
      var hike = arg.data;
      router.push("editHike", hike);
}
function goToHikeArab(arg) {
      var hike = arg.data;
      router.push("goToHikeArab", hike);
} 
module.exports = {
        isLoading: isLoading,
        reloadHandler: reloadHandler,
        dataSource: dataTech,
        dataSource2: dataSports,
        dataSource3: dataPolitics,
        dataSource4: dataEconomie,

        goToHike: goToHike,
        goToHikeArab : goToHikeArab,
        imageFull:imageFull
};

okay :
on the fuse monitor i have this error:

LOG: Deprecated: Use `DefaultPath` instead of `DefaultTemplate` in Fuse.Controls.Navigator</usr/local/share/uno/Packages/Fuse.Controls.Navigation/0.40.8/$.uno:876>
LOG: Deprecated: Use `DefaultPath` instead of `DefaultTemplate` in Fuse.Controls.Navigator</usr/local/share/uno/Packages/Fuse.Controls.Navigation/0.40.8/$.uno:876>
LOG: Deprecated: Use a `NavigationMotion` and the `GotoEasing` property instead of `Navigation.Easing` in Fuse.Navigation.LinearNavigation</usr/local/share/uno/Packages/Fuse.Navigation/0.40.8/$.uno:2966>
LOG: Error: JavaScript error in Pages/HomePage.js line 21: Name: ReferenceError: fetch is not defined
    Error message: Uncaught ReferenceError: fetch is not defined
    File name: Pages/HomePage.js
    Line number: 21
    Source line:     fetch ("https://news.placeholder.tn/highteck.json")
    JS stack trace: ReferenceError: fetch is not defined
        at reloadHandler (Pages/HomePage.js:21:5)
        at null._tempMethod (Pages/HomePage.js:43:1)
     in Fuse.Reactive.JavaScript</usr/local/share/uno/Packages/Fuse.Reactive/0.40.8/$.uno:1445>

here is screen shot of the app

Thanks for the project. It does look like something doesn’t work quite right.
We’ll take a closer look and get back to you.

Thank you , okay i am waiting :slight_smile:

It seems like including JS files by using <JavaScript File="someJavaScriptFile.js" ux:Global="MyModule" /> is not working anymore. We need to investigate this.
But it is an other way that I would recommend anyway. Remove the entries where you include JS files with ux:Global and include them in your project with Bundle instead, like this:

  "Packages": [
  	"Fuse",
  	"FuseJS"
  ],
  "Includes": [
    "*",
    "Auth.js:Bundle"
  ]
}

You can read more about this approach here

I have tried this and the same error.

Did you remove the line in your MainView file? It worked when I tried it on your project I got from @remi.

Is the error coming from auth.js file ? i should include it in uno ?

solved!
thank you :smiley: