From 668928cbff057f62e2919f6f398cfea315ee6fd3 Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 21 Nov 2022 17:11:16 +0000 Subject: [PATCH] feat: don't get the same image twice in a row Works with Mue API only, not Unsplash and not photo packs. --- src/components/widgets/background/Background.jsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/widgets/background/Background.jsx b/src/components/widgets/background/Background.jsx index b4749561..3d618951 100644 --- a/src/components/widgets/background/Background.jsx +++ b/src/components/widgets/background/Background.jsx @@ -94,7 +94,13 @@ export default class Background extends PureComponent { const backgroundAPI = localStorage.getItem('backgroundAPI'); const apiQuality = localStorage.getItem('apiQuality'); - const backgroundExclude = JSON.parse(localStorage.getItem('backgroundExclude')); + let backgroundExclude = JSON.parse(localStorage.getItem('backgroundExclude')); + if (!Array.isArray(backgroundExclude)) { + backgroundExclude = []; + } + if (this.state.photoInfo.pun) { + backgroundExclude.push(this.state.photoInfo.pun) + } let requestURL, data; switch (backgroundAPI) {