Skip to content

Commit

Permalink
fix no rows to show if there is no identifier & spliy_by_id is false
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcn04 committed Apr 20, 2024
1 parent 3b7b97f commit deae50f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions paramount/client/src/pages/EvaluatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ACCURATE_EVALUATION,
INACCURATE_EVALUATION,
NONE_EVALUATION,
SPLIT_BY_ID,
} from '@/lib/constants'
import EvaluateReviewIndicators from '@/components/EvaluatePage/EvaluateReviewIndicators'
import EvaluateReviewCard from '@/components/EvaluatePage/EvaluateReviewCard'
Expand All @@ -20,6 +21,7 @@ import SaveSessionModal from '@/components/Modals/SaveSessionModal'

import 'ag-grid-community/styles/ag-grid.css'
import 'ag-grid-community/styles/ag-theme-quartz.css'
import { useNavigate } from 'react-router-dom'

export default function EvaluatePage() {
const {
Expand All @@ -34,6 +36,7 @@ export default function EvaluatePage() {
updatedEvaluateRecords,
setUpdatedEvaluateRecords,
} = useContext(AppContext)
const navigator = useNavigate()

const gridRef = useRef<AgGridReact>(null)
const [searchKey, setSearchKey] = useState<string>('')
Expand Down Expand Up @@ -131,8 +134,12 @@ export default function EvaluatePage() {

const fetchEvaluateData = async () => {
const foundIdentifier = localStorage.getItem('identifier')
if (!foundIdentifier) return
await getEvaluateData(foundIdentifier)
const splitById = config[SPLIT_BY_ID]
if (!foundIdentifier && splitById) {
navigator('/')
return
}
await getEvaluateData(foundIdentifier!)
}

useEffect(() => {
Expand Down

0 comments on commit deae50f

Please sign in to comment.