{"id":32803,"date":"2022-10-13T12:00:56","date_gmt":"2022-10-13T06:30:56","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=32803"},"modified":"2026-02-12T11:41:06","modified_gmt":"2026-02-12T06:11:06","slug":"use-of-ispropertyloading-property-in-pcf-control","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2022\/10\/use-of-ispropertyloading-property-in-pcf-control\/","title":{"rendered":"Use of isPropertyLoading property in PCF Control"},"content":{"rendered":"<p>Recently, while working with a virtual Power Apps Component Framework <a href=\"https:\/\/www.inogic.com\/blog\/2022\/04\/exclusive-sneak-peek-at-the-new-virtual-pcf-component\/\" target=\"_blank\" rel=\"noopener\">(PCF)<\/a> control in a model-driven app, you may encounter a situation where your PCF control does not load the bound field data on the first load of the form.<\/p>\n<p>Let\u2019s have a look at the issue first. As seen in the below screenshot, you have added your custom PCF control to the First Name field of a Contact record. Kindly refer to this <a href=\"https:\/\/www.inogic.com\/blog\/2022\/10\/steps-to-use-onoutputchange-client-api-reference\/\" target=\"_blank\" rel=\"noopener\">blog<\/a> to have a look at it as well. Here you can see that the contact does have a First Name value, but your PCF control is not rendering the existing value during the initial form load.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-32804\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/1PCF-control-ink.jpeg\" alt=\"PCF control\" width=\"372\" height=\"310\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/1PCF-control-ink.jpeg 372w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/1PCF-control-ink-300x250.jpeg 300w\" sizes=\"(max-width: 372px) 100vw, 372px\" \/><\/p>\n<p>This happens, because as per my observation the PCF controls end up loading first before the full form is loaded which causes an issue while loading the default values. So to overcome this, I will use a property that is passed through context known as isPropertyLoading.<\/p>\n<p>As per my observation, isPropertyLoading will return true until the form is completely loaded and the context can get actual field values instead of null.<\/p>\n<p>So I will add a conditional rendering based on the isPropertyLoading property. Where I will render our component only when isPropertyLoading is false. Below is how I will implement this \u2013<\/p>\n<pre class=\"lang:css gutter:true start:1\">\/**\r\n\r\n* It is called when some value in the property bag has been changed. This includes field values, data sets, global values such as the container height and width, offline status, and control metadata values such as label, visible, and more.\r\n\r\n* @param context The entire property bag is available to control via Context Object; It contains values as set up by the customizer mapped to names defined in the manifest, as well as utility functions\r\n\r\n* @returns ReactElement root react element for the control\r\n\r\n*\/\r\n\r\npublic updateView(context: ComponentFramework.Context&lt;IInputs&gt;): React.ReactElement {\r\n\r\n\/\/@ts-ignore\r\n\r\nlet isPropertyLoading:boolean = context.parameters.textField.isPropertyLoading;\r\n\r\nif(!isPropertyLoading){\r\n\r\nconst props: IStringChekerProps = {\r\n\r\ndefaultValue: context.parameters.textField.raw!,\r\n\r\nonInputChanged: (event: React.FormEvent&lt;HTMLInputElement | HTMLTextAreaElement&gt;, newValue?: string | undefined) =&gt; {\r\n\r\nthis.currentFieldValue = newValue!;\r\n\r\nthis.isValidString = this.validateStringField(this.currentFieldValue);\r\n\r\nthis.notifyOutputChanged();\r\n\r\n}\r\n\r\n}\r\n\r\nreturn React.createElement(\r\n\r\nStringCheker, props\r\n\r\n);\r\n\r\n}\r\n\r\nelse {\r\n\r\nreturn React.createElement(\"div\");\r\n\r\n}\r\n\r\n}<\/pre>\n<p>What I\u2019ve done is we are returning the empty element by return React.createElement(&#8220;div&#8221;); when isPropertyLoading is true and return the actual component only when the isPropertyLoading is false. After this change, the control will load normally like the below \u2013<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-32805\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/2PCF-control.jpeg\" alt=\"PCF control\" width=\"371\" height=\"309\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/2PCF-control.jpeg 371w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2022\/10\/2PCF-control-300x250.jpeg 300w\" sizes=\"(max-width: 371px) 100vw, 371px\" \/><\/p>\n<p>This is how we can use isPropertyLoading to prevent displaying empty PCF values even though data exists.<\/p>\n<h2><strong>FAQs<\/strong><\/h2>\n<ul>\n<li><strong>What is isPropertyLoading in PCF?<\/strong><\/li>\n<\/ul>\n<p>isPropertyLoading is a property available inside context.parameters.&lt;fieldName&gt; in a Power Apps PCF control.<\/p>\n<p>It indicates whether the field data in the property bag is still loading.<\/p>\n<ul>\n<li>Returns true \u2192 Field data is still being initialized<\/li>\n<li>Returns false \u2192 Field data is available<\/li>\n<\/ul>\n<p>You can use this property to handle PCF lifecycle timing issues and prevent null rendering.<\/p>\n<ul>\n<li><strong>Why does context.parameters.raw return null in PCF?<\/strong><\/li>\n<\/ul>\n<p>If context.parameters.&lt;field&gt;.raw returns null, it usually means the form has not completed loading the field data yet.<\/p>\n<p>This is a common issue in model-driven app PCF controls, especially during the first execution of updateView().<\/p>\n<p>Using isPropertyLoading ensures you access raw only after the property bag is fully initialized.<\/p>\n<ul>\n<li><strong>How do you fix PCF default value not rendering?<\/strong><\/li>\n<\/ul>\n<p>If your PCF default value is not rendering, you can:<\/p>\n<ol>\n<li>Check parameters.&lt;field&gt;.isPropertyLoading<\/li>\n<li>Render your React component only when it is false<\/li>\n<li>Return an empty container while it is true<\/li>\n<\/ol>\n<p>This prevents the control from rendering before the field value becomes available.<\/p>\n<p><script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [{\n    \"@type\": \"Question\",\n    \"name\": \"What is isPropertyLoading in PCF?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"isPropertyLoading is a property available inside context.parameters.<fieldName> in a Power Apps PCF control.\nIt indicates whether the field data in the property bag is still loading.\n\u2022\tReturns true \u2192 Field data is still being initialized\n\u2022\tReturns false \u2192 Field data is available\nYou can use this property to handle PCF lifecycle timing issues and prevent null rendering.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"Why does context.parameters.raw return null in PCF?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"If context.parameters.<field>.raw returns null, it usually means the form has not completed loading the field data yet.\nThis is a common issue in model-driven app PCF controls, especially during the first execution of updateView().\nUsing isPropertyLoading ensures you access raw only after the property bag is fully initialized.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"How do you fix PCF default value not rendering?\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"If your PCF default value is not rendering, you can:\n1.\tCheck context.parameters.<field>.isPropertyLoading\n2.\tRender your React component only when it is false\n3.\tReturn an empty container while it is true\nThis prevents the control from rendering before the field value becomes available.\"\n    }\n  }]\n}\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, while working with a virtual Power Apps Component Framework (PCF) control in a model-driven app, you may encounter a situation where your PCF control does not load the bound field data on the first load of the form. Let\u2019s have a look at the issue first. As seen in the below screenshot, you have\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2022\/10\/use-of-ispropertyloading-property-in-pcf-control\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[44,1929,2361],"tags":[1941],"class_list":["post-32803","post","type-post","status-publish","format-standard","hentry","category-power-apps","category-pcf","category-technical","tag-pcf-control"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/32803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=32803"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/32803\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=32803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=32803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=32803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}