mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-29 07:30:32 +01:00
Prevented overlapping modals in react tree and fixed request canceling.
This commit is contained in:
parent
805133d10c
commit
e6da977c48
2 changed files with 48 additions and 41 deletions
|
@ -40,7 +40,7 @@
|
||||||
"prop-types": "^15.6.0",
|
"prop-types": "^15.6.0",
|
||||||
"react": "^16.3.2",
|
"react": "^16.3.2",
|
||||||
"react-aria-menubutton": "^5.1.1",
|
"react-aria-menubutton": "^5.1.1",
|
||||||
"react-aria-modal": "^2.12.1",
|
"react-aria-modal": "^3.0.0",
|
||||||
"react-autobind": "^1.0.6",
|
"react-autobind": "^1.0.6",
|
||||||
"react-autocomplete": "^1.7.2",
|
"react-autocomplete": "^1.7.2",
|
||||||
"react-codemirror2": "^4.2.1",
|
"react-codemirror2": "^4.2.1",
|
||||||
|
|
|
@ -76,7 +76,10 @@ class OpenModal extends React.Component {
|
||||||
onStyleSelect = (styleUrl) => {
|
onStyleSelect = (styleUrl) => {
|
||||||
this.clearError();
|
this.clearError();
|
||||||
|
|
||||||
|
const requestController = new AbortController();
|
||||||
|
|
||||||
const activeRequest = fetch(styleUrl, {
|
const activeRequest = fetch(styleUrl, {
|
||||||
|
signal: requestController.signal,
|
||||||
mode: 'cors',
|
mode: 'cors',
|
||||||
credentials: "same-origin"
|
credentials: "same-origin"
|
||||||
})
|
})
|
||||||
|
@ -165,7 +168,9 @@ class OpenModal extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <Modal
|
return (
|
||||||
|
<div>
|
||||||
|
<Modal
|
||||||
data-wd-key="open-modal"
|
data-wd-key="open-modal"
|
||||||
isOpen={this.props.isOpen}
|
isOpen={this.props.isOpen}
|
||||||
onOpenToggle={() => this.onOpenToggle()}
|
onOpenToggle={() => this.onOpenToggle()}
|
||||||
|
@ -200,6 +205,7 @@ class OpenModal extends React.Component {
|
||||||
{styleOptions}
|
{styleOptions}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
<LoadingModal
|
<LoadingModal
|
||||||
isOpen={!!this.state.activeRequest}
|
isOpen={!!this.state.activeRequest}
|
||||||
|
@ -207,7 +213,8 @@ class OpenModal extends React.Component {
|
||||||
onCancel={(e) => this.onCancelActiveRequest(e)}
|
onCancel={(e) => this.onCancelActiveRequest(e)}
|
||||||
message={"Loading: "+this.state.activeRequestUrl}
|
message={"Loading: "+this.state.activeRequestUrl}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue