<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1719000#M88577</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1008871"&gt;@lingyanmao&lt;/a&gt;,&amp;nbsp;thanks for posting your question here. Unfortunately, my first thought is, can you reproduce this issue with the latest version? We're currently at version 5.1.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/release-notes/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/release-notes/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Aug 2026 15:56:13 GMT</pubDate>
    <dc:creator>Noah-Sager</dc:creator>
    <dc:date>2026-08-06T15:56:13Z</dc:date>
    <item>
      <title>[esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1718879#M88575</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;The following content comes from a translator, please forgive any inaccuracies. Thank you very much.&lt;/FONT&gt; Title&lt;/P&gt;&lt;P&gt;SceneLayer throws "Please use getSymbolAsync if valueExpression is used" when swapping a UniqueValueRenderer with valueExpression at runtime&lt;/P&gt;&lt;P&gt;Environment&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;ArcGIS Maps SDK for JavaScript version: 4.32&lt;/LI&gt;&lt;LI&gt;Layer type:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;esri/layers/&lt;/SPAN&gt;&lt;SPAN class=""&gt;SceneLayer&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(Hosted Scene Layer, geometryType is&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mesh, I3S service)&lt;/LI&gt;&lt;LI&gt;View type:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;esri/views/&lt;/SPAN&gt;&lt;SPAN class=""&gt;SceneView&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Renderer:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;esri/renderers/&lt;/SPAN&gt;&lt;SPAN class=""&gt;UniqueValueRenderer&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(Arcade) instead of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;field&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Description&lt;/P&gt;&lt;P&gt;When a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;UniqueValueRenderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is passed to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;renderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property inside the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;constructor&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer, the layer loads and renders correctly with no console errors.&lt;/P&gt;&lt;P&gt;However, once the layer has already finished loading and is being rendered in the view, if I swap the renderer at runtime (i.e.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sceneLayer.renderer = newUniqueValueRenderer, where&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;newUniqueValueRenderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;also uses&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression), the console keeps throwing:&lt;/P&gt;&lt;P&gt;[esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used&lt;/P&gt;&lt;P&gt;Steps to reproduce&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;Create a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(mesh geometryType, Hosted I3S service) with a plain&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;simple&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;renderer passed in the constructor.&lt;/LI&gt;&lt;LI&gt;Add it to the map and wait for&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sceneLayer.when()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to resolve, confirming the layer is loaded and rendered.&lt;/LI&gt;&lt;LI&gt;Then run:&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;sceneLayer&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;renderer&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;type&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;unique-value&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;valueExpression&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;var floor = $feature.floor_no; if (floor &amp;gt;= 10) return 'high'; return 'low';&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;uniqueValueInfos&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;[&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;{&lt;/SPAN&gt; &lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;high&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;symbol&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;highSymbol&lt;/SPAN&gt; &lt;SPAN&gt;},&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;{&lt;/SPAN&gt; &lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;low&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt; &lt;SPAN&gt;symbol&lt;/SPAN&gt;&lt;SPAN&gt;:&lt;/SPAN&gt; &lt;SPAN&gt;lowSymbol&lt;/SPAN&gt; &lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;Check the browser console — a large number of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Please use getSymbolAsync if valueExpression is used&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;errors appear.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Expected behavior&lt;/P&gt;&lt;P&gt;Whether a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression-based renderer is passed at construction time or assigned at runtime after the layer is already loaded, it should consistently be resolved through the async&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;getSymbolAsync()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;path internally. There should be no code path calling the synchronous&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;getSymbol(), and no console errors.&lt;/P&gt;&lt;P&gt;Actual behavior&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;Renderer with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;passed at construction time:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;no errors&lt;/SPAN&gt;, renders correctly.&lt;/LI&gt;&lt;LI&gt;Renderer with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;assigned at runtime after the layer has loaded:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;errors are thrown repeatedly&lt;/SPAN&gt;. My suspicion is that when SceneLayerView re-symbolizes features that are already present in the GPU buffers, it takes an internal synchronous code path that calls&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;renderer.getSymbol()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instead of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;getSymbolAsync().&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Visually, the rendering still appears correct in most cases, but the sheer volume of console errors makes this unacceptable for a production app.&lt;/P&gt;&lt;P&gt;Current workaround&lt;/P&gt;&lt;P&gt;Instead of hot-swapping the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;renderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;property, we now remove the layer from the map (view.map.remove(layer)) and recreate a brand-new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;instance with the new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression-based renderer passed in the constructor, then add it back to the map. This avoids the error, but it means re-fetching and re-decoding all tiles every time the renderer changes, which is not ideal for performance.&lt;/P&gt;&lt;P&gt;Ask&lt;/P&gt;&lt;P&gt;Could the team please confirm:&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;Is this a known limitation/bug specific to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(as opposed to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;FeatureLayer, where runtime renderer swaps with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;may behave differently)?&lt;/LI&gt;&lt;LI&gt;Is there an officially recommended way to swap a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression-based&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;UniqueValueRenderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;at runtime on an already-loaded&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;without having to recreate the layer?&lt;/LI&gt;&lt;LI&gt;Is there a plan to fix this internal synchronous call path in a future release?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Thu, 06 Aug 2026 04:48:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1718879#M88575</guid>
      <dc:creator>lingyanmao</dc:creator>
      <dc:date>2026-08-06T04:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: [esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1719000#M88577</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1008871"&gt;@lingyanmao&lt;/a&gt;,&amp;nbsp;thanks for posting your question here. Unfortunately, my first thought is, can you reproduce this issue with the latest version? We're currently at version 5.1.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/release-notes/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/release-notes/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Aug 2026 15:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1719000#M88577</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2026-08-06T15:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: [esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1719121#M88580</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt;&amp;nbsp; , thanks a lot for your reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I’ve retested with the latest&amp;nbsp;&lt;SPAN class=""&gt;ArcGIS Maps SDK for JavaScript 5.1&lt;/SPAN&gt;&amp;nbsp;, and the issue&amp;nbsp;&lt;SPAN class=""&gt;still reproduces&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Summary&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN class=""&gt;Path A (OK):&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Pass a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;UniqueValueRenderer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;valueExpression&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;constructor → renders correctly, no console error.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="andale mono,times"&gt;&lt;SPAN class=""&gt;Path B (FAIL):&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Load the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;SceneLayer&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with a simple renderer first, then assign the same UVR at runtime via&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;sceneLayer.renderer = ...&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;→ console still throws:&lt;SPAN&gt;[esri.renderers.UniqueValueRenderer] #getSymbol() Please use getSymbolAsync if valueExpression is used&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;script type="module" src="https://js.arcgis.com/5.1/"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="module"&amp;gt;
  const [Map, SceneView, SceneLayer] = await $arcgis.import([
    '@arcgis/core/Map.js',
    '@arcgis/core/views/SceneView.js',
    '@arcgis/core/layers/SceneLayer.js'
  ]);

  const LAYER_URL = 'https://xyz';

  function meshSymbol(color) {
    return {
      type: 'mesh-3d',
      symbolLayers: [{
        type: 'fill',
        material: { color, colorMixMode: 'replace' }
      }]
    };
  }

  function createUniqueValueRenderer() {
    return {
      type: 'unique-value',
      valueExpression: [
        'var h = DefaultValue($feature.Height, 0);',
        "if (h &amp;gt;= 30) return 'high';",
        "if (h &amp;gt;= 15) return 'mid';",
        "return 'low';"
      ].join('\n'),
      uniqueValueInfos: [
        { value: 'low', symbol: meshSymbol([153, 197, 246, 0.9]) },
        { value: 'mid', symbol: meshSymbol([255, 204, 51, 0.9]) },
        { value: 'high', symbol: meshSymbol([255, 99, 71, 0.9]) }
      ]
    };
  }

  const view = new SceneView({
    container: 'viewDiv',
    map: new Map({ basemap: 'satellite', ground: 'world-elevation' })
  });

  // Path B
  const sceneLayer = new SceneLayer({
    url: LAYER_URL,
    outFields: ['*'],
    renderer: {
      type: 'simple',
      symbol: meshSymbol([255, 255, 255, 0.9])
    }
  });

  view.map.add(sceneLayer);
  await sceneLayer.when();

  // error:
  // Please use getSymbolAsync if valueExpression is used
  sceneLayer.renderer = createUniqueValueRenderer();
&amp;lt;/script&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Notes&lt;/STRONG&gt;&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;&lt;STRONG&gt;Same renderer works when passed in the constructor.&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;valueExpression&amp;nbsp;is required for our real use case (we cannot fall back to&amp;nbsp;field).&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2026 00:36:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/esri-renderers-uniquevaluerenderer-getsymbol/m-p/1719121#M88580</guid>
      <dc:creator>lingyanmao</dc:creator>
      <dc:date>2026-08-07T00:36:25Z</dc:date>
    </item>
  </channel>
</rss>

