mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3555 from overleaf/jpa-word-count-clsi-persistence
[frontend] word-count-modal: bring back query param for clsi persistence GitOrigin-RevId: ec32b8525875e87b696929cb9c6f09c00bc58131
This commit is contained in:
parent
a3176e2b6b
commit
fb83d27476
2 changed files with 10 additions and 3 deletions
|
@ -3,7 +3,7 @@ import { Modal } from 'react-bootstrap'
|
|||
import PropTypes from 'prop-types'
|
||||
import WordCountModalContent from './word-count-modal-content'
|
||||
|
||||
function WordCountModal({ handleHide, show, projectId }) {
|
||||
function WordCountModal({ clsiServerId, handleHide, projectId, show }) {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [error, setError] = useState(false)
|
||||
const [data, setData] = useState()
|
||||
|
@ -21,7 +21,12 @@ function WordCountModal({ handleHide, show, projectId }) {
|
|||
const _abortController = new AbortController()
|
||||
setAbortController(_abortController)
|
||||
|
||||
fetch(`/project/${projectId}/wordcount`, {
|
||||
let query = ''
|
||||
if (clsiServerId) {
|
||||
query = `?clsiserverid=${clsiServerId}`
|
||||
}
|
||||
|
||||
fetch(`/project/${projectId}/wordcount${query}`, {
|
||||
signal: _abortController.signal
|
||||
})
|
||||
.then(async response => {
|
||||
|
@ -42,7 +47,7 @@ function WordCountModal({ handleHide, show, projectId }) {
|
|||
return () => {
|
||||
_abortController.abort()
|
||||
}
|
||||
}, [show, projectId])
|
||||
}, [show, projectId, clsiServerId])
|
||||
|
||||
const abortAndHide = useCallback(() => {
|
||||
abortController.abort()
|
||||
|
@ -62,6 +67,7 @@ function WordCountModal({ handleHide, show, projectId }) {
|
|||
}
|
||||
|
||||
WordCountModal.propTypes = {
|
||||
clsiServerId: PropTypes.string,
|
||||
handleHide: PropTypes.func.isRequired,
|
||||
projectId: PropTypes.string.isRequired,
|
||||
show: PropTypes.bool.isRequired
|
||||
|
|
|
@ -20,6 +20,7 @@ export default App.controller('WordCountModalController', function(
|
|||
|
||||
$scope.openWordCountModal = () => {
|
||||
$scope.$applyAsync(() => {
|
||||
$scope.clsiServerId = ide.clsiServerId
|
||||
$scope.projectId = ide.project_id
|
||||
$scope.show = true
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue