| 741 | } |
| 742 | |
| 743 | const getVariables = () => { |
| 744 | if ( |
| 745 | isUpvoted || |
| 746 | feedWithDateRange.includes(tab) || |
| 747 | feedWithDateRange.includes(urlToTab[router.pathname]) |
| 748 | ) { |
| 749 | return { ...config.variables, period: periods[selectedPeriod].value }; |
| 750 | } |
| 751 | |
| 752 | if (isAnyExplore) { |
| 753 | const laptopValue = |
| 754 | tab === ExploreTabs.ByDate || isExploreLatest ? 1 : 0; |
| 755 | const mobileValue = |
| 756 | urlToTab[router.pathname] === ExploreTabs.ByDate ? 1 : 0; |
| 757 | const finalAlgo = isLaptop ? laptopValue : mobileValue; |
| 758 | |
| 759 | return { |
| 760 | ...config.variables, |
| 761 | ranking: algorithms[finalAlgo].value, |
| 762 | }; |
| 763 | } |
| 764 | |
| 765 | if (isSortableFeed) { |
| 766 | return { |
| 767 | ...config.variables, |
| 768 | ranking: algorithms[selectedAlgo].value, |
| 769 | }; |
| 770 | } |
| 771 | |
| 772 | return config.variables; |
| 773 | }; |
| 774 | |
| 775 | // The draft goes last, so the feed's own key is this one without it. |
| 776 | const feedVariables = getVariables(); |