Skip to content

Commit 6efc28f

Browse files
stdavissteveoh
andauthored
fix: simplify center/scale initalization
Co-authored-by: steveoh <[email protected]>
1 parent 208c422 commit 6efc28f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/components/MapContainer.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,13 @@ export const MapContainer = ({ onClick }: { onClick?: __esri.ViewImmediateClickE
4040
};
4141

4242
const xyUrlParam = getUrlParameter<number[]>('center', 'number[]');
43-
if (xyUrlParam) {
43+
if (xyUrlParam && xyUrlParam.length === 2) {
4444
viewOptions.center = {
4545
x: xyUrlParam[0],
4646
y: xyUrlParam[1],
4747
spatialReference: { wkid: 3857 },
4848
};
49-
}
50-
if (xyUrlParam && xyUrlParam.length === 2) {
49+
5150
const scaleUrlParam = getUrlParameter<number>('scale', 'number', 10000);
5251
if (scaleUrlParam) {
5352
viewOptions.scale = scaleUrlParam;

0 commit comments

Comments
 (0)