GithubHelp home page GithubHelp logo

esri-react-boot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esri-react-boot's Issues

Consistency issues found while following Esri Events video https://www.youtube.com/watch?v=GTXL8YfGS9M

Following basic examples from:
https://www.youtube.com/watch?v=GTXL8YfGS9M

esri-react-boot/src/components/esri/map/Map.js
Line 48 change to:
this.props.config.mapConfig,

(the Map.js example did not work without this change)

Line 84 change to:
this.props.mapLoaded();

esri-react-boot/src/components/esri/map/SceneViewExample.js
Line 48 change to:
this.props.config.mapConfig,

Line 84 change to:
this.props.mapLoaded();

Details here: https://docs.google.com/document/d/17tYzUF45GF-EiWqy5DZ2mDTvjnBUiRGIRbko8-iPrLY/edit?usp=sharing

Prevent Map Component from re-render if state change

I found this comment inside the project but still i didn't figure out how can i prevent map from reload

Conceptually, this component creates a "portal" in React by
closing its render method off from updates (by simply rendering a div and
never accepting re-renders) then reconnecting itself to the React lifecycle
by listening for any new props (using componentWillReceiveProps)

I want to send location as props to map then map zoom to this location
my issue that the map component keep re-rendering every time the location change

Problems accessing portal with auth

I'm working on a web app that uses a single sign on event in order to allow access to multiple ArcGIS portal items. The general workflow I'm going for is this:

  1. User signs into portal specified in config.json file
  2. Once signed in, authorization info is sent to Redux and stored in "auth" (boilerplate)
  3. An authorization token is pulled from Redux (auth.token) and sent to IdentityManager to access a portal item without having to sign in again

I'm running into problems with the third step. For some reason, when I include step 3 and try to use the initial login to the app, I get the following error:

SyntaxError: JSON Parse error: Unexpected identifier "<CLIENT ID>"
(Where CLIENT ID is the clientID specified in the config.json file)

I'm using the boilerplate code, except I've adapted it slightly to utilize the Javascript 4.18 modules to be more Reactive. I've included my code for Map.js below.

Any guidance on the best workflow to utilize the initial portal sign in to access portal items without a second login?

Map.js:

import React, { useRef, useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { useSelector } from 'react-redux';

import WebMap from '@arcgis/core/WebMap';
import MapView from '@arcgis/core/views/MapView';
import IdentityManager from '@arcgis/core/identity/IdentityManager';

import MapContext from 'context/MapContext';

const MapContainer = styled.div(({ style, theme }) => ({
  width: '100%',
  height: '100%',
  color: theme.lightGrey1,
  ...style
}));
const Map = ({ children, mapConfig, clientId }) => {
  const mapDiv = useRef(null);
  const auth = useSelector(state => state.auth);
  const [viewObj, setView] = useState(null);
  const [mapObj, setMap] = useState(null);

  useEffect(() => {
    if (auth.token) {
      const portalItem = {
        id: <PORTAL ID>,
        portal: {
          portalUrl: <PORTAL URL>,
          authMode: 'immediate'
        }
      };

      IdentityManager.registerToken(auth.token);

      const map = new WebMap({ ...mapConfig, portalItem });

      if (mapDiv.current) {
        const view = new MapView({
          map,
          container: mapDiv.current,
          ui: {
            components: ['zoom']
          }
        });
        setView(view);
        setMap(map);
      }
    }
  }, [auth]);

  return (
    <MapContext.Provider value={{ viewObj, mapObj }}>
      <MapContainer ref={mapDiv}>{children}</MapContainer>
    </MapContext.Provider>
  );
};

Map.defaultProps = {
  children: null,
  mapConfig: {},
  clientId: ''
};

Map.propTypes = {
  children: PropTypes.any,
  mapConfig: PropTypes.object,
  clientId: PropTypes.string
};

export default Map;

Alternatively, I've been able to get the following workflow to work, but it's not ideal:

  1. Remove portalUrl from config.json
  2. Use OAuthInfo and IdentityManager.registerOAuthInfos()

The problem with this approach is that you don't have a global login accessible in Redux

React Router - Upgrade to v5?

Just had an issue trying to get routes to render properly using <Link> components. The route would render on a full page refresh, but not when using the <Link to="/myroute" /> component in a Header. After some research that really didn't get me anywhere, I just tried upgrading to "react-router-dom": "5.0.0" and the Link components started working. Wish I could be more helpful about what the actual problem was, but hopefully this can be of use to anyone else experiencing the same thing.

state of map loaded

Hi thanks for such a great work. when ı start the project map loaded but in state doesnt change always false ?

map_loaded

state of map reducer not changed MAP_LOADED action is not triggered . Am I only one having that issue how can I change the state of map loaded to true

Can't load 4.14 version of api

I'm trying to implement the 4.14 api to the application. I already changeds the jsapiURL in config, but upon checking the console, 4.13 is what getting loaded. Any solution for this? Thank you.

Cannot Display Topographic Map?

I am following the Tutorials on ArcGIS Developer,and I am having an issue accessing other basemaps. In all tutorials they use the API Key, but I assume this would still work here? I even logged in and the map does not show.

"mapConfig": {
    "basemap": "arcgis-topographic",
    "center": [-118.805, 34.027],
    "zoom": 13
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.