Skip to content

Commit

Permalink
feat: navigate to same component after edit
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswhong committed Dec 21, 2021
1 parent 242fb23 commit 3775beb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/features/datasetEditor/ExistingDatasetEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from "react"
import { useHistory } from 'react-router'
import { useDispatch, useSelector } from "react-redux"
import { useLocation } from 'react-router-dom'

import DatasetEditorLayout from './DatasetEditorLayout'
import { loadDataset } from '../dataset/state/datasetActions'
Expand All @@ -21,7 +22,9 @@ const DEFAULT_DATASET_COMMIT_TITLE = ''
const ExistingDatasetEditor: React.FC<{}> = () => {
const dispatch = useDispatch()
const history = useHistory()
const location = useLocation()

console.log('location', location)
const dataset = useSelector(selectDatasetEditorDataset)
const isLoading = useSelector(selectDatasetEditorLoading)
const file = useSelector(selectDatasetEditorFile)
Expand Down Expand Up @@ -76,7 +79,7 @@ const ExistingDatasetEditor: React.FC<{}> = () => {
}

const handleClose = () => {
history.push(`/${dataset.username}/${dataset.name}/history`)
history.push(`/${dataset.username}/${dataset.name}/history${location.hash}`)
}

return (
Expand Down

0 comments on commit 3775beb

Please sign in to comment.