Skip to content

Commit

Permalink
substitute useMemo for useState
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow committed Jul 19, 2024
1 parent 55384e6 commit 4e6d522
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const _ServiceEditDrawer = forwardRef<HTMLButtonElement, ServiceDrawerProps>(
({ serviceId: passedServiceId, createNew, ...props }, ref) => {
const { id: organizationId } = useOrgInfo()
const router = useRouter()
const [serviceId, _setServiceId] = useState(passedServiceId ?? generateId('orgService'))
const serviceId = useMemo(() => passedServiceId ?? generateId('orgService'), [passedServiceId])
const [drawerOpened, drawerHandler] = useDisclosure(false)
const [modalOpened, modalHandler] = useDisclosure(false)
const notifySave = useNewNotification({ displayText: 'Saved', icon: 'success' })
Expand Down Expand Up @@ -244,7 +244,7 @@ const _ServiceEditDrawer = forwardRef<HTMLButtonElement, ServiceDrawerProps>(
const serviceUpsert = api.service.upsert.useMutation({
onSuccess: () => {
notifySave()
apiUtils.location.forLocationPageEdits.invalidate()
apiUtils.location.invalidate()
apiUtils.service.invalidate()
if (isNew) {
apiUtils.service.forServiceEditDrawer.invalidate(serviceId)
Expand Down

0 comments on commit 4e6d522

Please sign in to comment.