From 6c07ebe9923fc03ef11974a48633bf97daff394e Mon Sep 17 00:00:00 2001 From: Vladimir Borisov Date: Mon, 30 Sep 2019 15:18:11 +0300 Subject: [PATCH] Cache callback functions --- src/routes/Settings/SectionsList/SectionsList.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/Settings/SectionsList/SectionsList.js b/src/routes/Settings/SectionsList/SectionsList.js index e09981711..3ffd6a3d8 100644 --- a/src/routes/Settings/SectionsList/SectionsList.js +++ b/src/routes/Settings/SectionsList/SectionsList.js @@ -13,18 +13,18 @@ const SectionsList = React.forwardRef(({ className, sections, preferences, onPre onPreferenceChanged(id, color); }; - const updateDropdown = (event) => { + const updateDropdown = React.useCallback((event) => { var data = event.currentTarget.dataset; onPreferenceChanged(data.name, data.value); - }; + }); - const checkUser = (event) => { + const checkUser = React.useCallback((event) => { if(! preferences.user) { // Here in Stremio 4 we show a toast with a message, asking the anonymous user to log in/register console.log('No user found'); event.preventDefault(); } - } + }); // Determines whether the link should be opened in new window or in the current one. const getTargetFor = url => ['//', 'http://', 'https://', 'file://', 'ftp://', 'mailto:', 'magnet:']