@@ -53,14 +53,16 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
5353 return cleanup ;
5454 } , [ ] ) ;
5555
56+ let initialUrl = `/static/rapid-editor.html${ initialHash } ` ;
57+
5658 if ( window . env . REACT_APP_OSM_API_SERVER === "https://api.openstreetmap.org" ) {
5759 // Only pass auth token to Rapid if it's for the production OSM API (not the dev API)
5860 // since Rapid assumes any token it's given is valid on api.openstreetmap.org.
5961 // See: https://github.com/facebook/Rapid/issues/1341
6062
6163 // NOTE: the assumption here is that REACT_APP_OSM_API_SERVER is the same as
6264 // the maproulette-backend's config.osm.server; fix your configs if they differ!
63- initialHash += `&token=${ token } ` ;
65+ initialUrl += `&token=${ token } ` ;
6466 }
6567
6668 const handleResetHash = ( ) => {
@@ -91,7 +93,7 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
9193 ref = { iframeRef }
9294 id = "rapid-container-root"
9395 style = { { width : "100%" , height : "100%" } }
94- src = { `/static/rapid-editor.html ${ initialHash } ` }
96+ src = { initialUrl }
9597 onLoad = { async ( event ) => {
9698 let iframe = event . target ;
9799
@@ -113,6 +115,11 @@ const RapidEditor = ({ token, task, mapBounds, comment }) => {
113115 let hasUnsavedChanges = context . systems . editor . hasChanges ( ) ;
114116 dispatch ( { type : SET_RAPIDEDITOR , context : { hasUnsavedChanges } } ) ;
115117 } ) ;
118+
119+ // Ensure the hash is processed correctly after Rapid has fully loaded
120+ // (setting the initial map zoom doesn't work if we only pass the hash
121+ // to the iframe on initial load for some reason)
122+ iframe . contentWindow . location . hash = initialHash ;
116123 } catch ( err ) {
117124 setError ( err ) ;
118125 } finally {
0 commit comments