Skip to content

Commit

Permalink
feat: set active key row when params change
Browse files Browse the repository at this point in the history
  • Loading branch information
d-rita committed Dec 20, 2024
1 parent 91c62ba commit df09fee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/table/ItemsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TableBody,
TableHead,
} from '@dhis2/ui'
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom'
import classes from '../../App.module.css'
import i18n from '../../locales'
Expand Down Expand Up @@ -39,6 +39,10 @@ const ItemsTable = ({
setActiveRow(item)
}

useEffect(() => {
setActiveRow(key)
}, [key])

return (
<div>
{data && (
Expand Down

0 comments on commit df09fee

Please sign in to comment.