Skip to content

Commit

Permalink
Merge pull request #1792 from theamanjs/1777-long-space-press
Browse files Browse the repository at this point in the history
fix: long spacebar press app break issue
  • Loading branch information
theamanjs authored Jul 3, 2023
2 parents b6b18c9 + 1c0ef89 commit 522138e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions www/main/navigator/shabad/ShabadContent.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable import/no-cycle */
/* eslint-disable no-unsafe-finally */
import Noty from 'noty';
import React, { useState, useEffect, useRef } from 'react';
Expand Down Expand Up @@ -75,12 +76,16 @@ const ShabadContent = () => {
};

const skipIkOnkar = (shabadVerses, index) => {
const { verse: gurmukhi } = shabadVerses[index].verse;
const { verseId } = shabadVerses[index];
if (verseId !== 1 && /^(<>)/gm.test(gurmukhi)) {
return index + 1;
if (shabadVerses[index]) {
// eslint-disable-next-line no-unsafe-optional-chaining
const { verse: gurmukhi } = shabadVerses[index]?.verse;
const { verseId } = shabadVerses[index];
if (verseId !== 1 && /^(<>)/gm.test(gurmukhi)) {
return index + 1;
}
return index;
}
return index;
return 0;
};

const filterRequiredVerseItems = (verses) => {
Expand Down Expand Up @@ -168,6 +173,7 @@ const ShabadContent = () => {
setVersesRead([...versesRead, newTraversedVerse]);
}
} else {
// eslint-disable-next-line no-lonely-if
if (!versesRead.some((traversedVerse) => traversedVerse === newTraversedVerse)) {
setVersesRead([...versesRead, newTraversedVerse]);
}
Expand Down

0 comments on commit 522138e

Please sign in to comment.