ESLint exceptions and safety on optional chaining.

This commit is contained in:
Bradley Shellnut 2022-01-09 16:22:45 -08:00
parent f9b5f3f4ba
commit 01ac00eda7
2 changed files with 52 additions and 46 deletions

View file

@ -34,7 +34,7 @@ export default withSession(async (req, res) => {
// console.log('group', group);
response.id = id;
const guestList = [];
for (const guestId of group?.guests) {
for (const guestId of group?.guests || []) {
// console.log(JSON.stringify(guestId));
const guestData = await Guest.findById(guestId);
const guest = {

View file

@ -297,7 +297,9 @@ export default function SingleGroupPage({ group }) {
gap: '1rem',
}}
>
{group?.guests?.map((guest) =>
{
// eslint-disable-next-line react/prop-types
group?.guests?.map((guest) =>
!guest.isPlusOne ? (
<QuestionStyles key={`${guest?.id}-dietaryNotes`}>
<p>
@ -319,7 +321,8 @@ export default function SingleGroupPage({ group }) {
) : (
''
)
)}
)
}
</div>
</fieldset>
<fieldset aria-busy={loading} disabled={loading}>
@ -330,7 +333,9 @@ export default function SingleGroupPage({ group }) {
gap: '1rem',
}}
>
{group?.guests?.map((guest) =>
{
// eslint-disable-next-line react/prop-types
group?.guests?.map((guest) =>
!guest?.isPlusOne ? (
<QuestionStyles key={`${guest?.id}-songRequests`}>
<p>
@ -352,7 +357,8 @@ export default function SingleGroupPage({ group }) {
) : (
''
)
)}
)
}
</div>
</fieldset>
<fieldset aria-busy={loading} disabled={loading}>
@ -436,7 +442,7 @@ export async function getServerSideProps({ params }) {
group.id = params.id;
const guestList = [];
for (const guestId of groupData?.guests) {
for (const guestId of groupData?.guests || []) {
const guestData = await Guest.findById(guestId);
const guest = {
id: guestData.id,