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 always false statement to check if values are not defined #747

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Changes from 3 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
33 changes: 23 additions & 10 deletions packages/berlin/src/pages/Register.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// React and third-party libraries
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useMemo, useState } from 'react';
import { UseFormReturn, useForm } from 'react-hook-form';
import toast from 'react-hot-toast';
import { useMemo, useState } from 'react';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { useNavigate, useParams } from 'react-router-dom';
import { z } from 'zod';
import toast from 'react-hot-toast';

// API
import {
Expand All @@ -23,21 +24,23 @@ import {
type GetUserResponse,
} from 'api';

// Utils
import { dataSchema, fieldsSchema } from '@/utils/form-validation';

// Hooks
import useUser from '../hooks/useUser';

// Components
import { dataSchema, fieldsSchema } from '@/utils/form-validation';
import { z } from 'zod';
import Button from '../components/button';
import { Carousel } from '../components/carousel';
import { FlexColumn } from '../components/containers/FlexColumn.styled';
import { Form } from '../components/containers/Form.styled';
import { FormInput, FormSelectInput } from '../components/form-input';
import Select from '../components/select';
import Label from '../components/typography/Label';
import { Subtitle } from '../components/typography/Subtitle.styled';
import { SafeArea } from '../layout/Layout.styled';
import { Subtitle } from '../components/typography/Subtitle.styled';
import Button from '../components/button';
import Label from '../components/typography/Label';
import Select from '../components/select';
import Skeleton from '@/components/skeleton';

function Register() {
const { user, isLoading } = useUser();
Expand Down Expand Up @@ -82,7 +85,7 @@ function Register() {
}

// if no fields exists then stay on group categories page
if (Object.values(fields).length === 0) {
if (Object.values(fields.data).length === 0) {
return 0;
}

Expand Down Expand Up @@ -390,6 +393,16 @@ function EventGroupsForm({
}
};

if (!groupCategories) {
return (
<div className="flex w-full flex-col gap-4">
<Skeleton className="h-5 w-60" />
<Skeleton className="h-10 w-full" />
<Skeleton className="h-9 w-20" />
</div>
);
}

return (
<FlexColumn>
{groupCategories
Expand Down
Loading