Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: long spacebar press app break issue #1792

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */
Gauravjeetsingh marked this conversation as resolved.
Show resolved Hide resolved
/* 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