MCPcopy Create free account
hub / github.com/UI5/webcomponents / _render

Function _render

packages/base/src/UI5Element.ts:892–958  ·  view source on GitHub ↗

* Do not call this method directly, only intended to be called by js * @protected

()

Source from the content-addressed store, hash-verified

890 * @protected
891 */
892 _render() {
893 const ctor = this.constructor as typeof UI5Element;
894 const hasIndividualSlots = ctor.getMetadata().hasIndividualSlots();
895
896 // restore properties that were initialized before `define` by calling the setter
897 if (this.initializedProperties.size > 0) {
898 Array.from(this.initializedProperties.entries()).forEach(([prop, value]) => {
899 delete (this as Record<string, unknown>)[prop];
900 (this as Record<string, unknown>)[prop] = value;
901 });
902 this.initializedProperties.clear();
903 }
904 // suppress invalidation to prevent state changes scheduling another rendering
905 this._suppressInvalidation = true;
906
907 try {
908 this.onBeforeRendering();
909
910 if (!this._rendered) {
911 // first time rendering, previous setters might have been initializers from the constructor - update attributes here
912 this.updateAttributes();
913 }
914
915 // Intended for framework usage only. Currently ItemNavigation updates tab indexes after the component has updated its state but before the template is rendered
916 this._componentStateFinalizedEventProvider.fireEvent("componentStateFinalized");
917 } finally {
918 // always resume normal invalidation handling
919 this._suppressInvalidation = false;
920 }
921
922 // Update the shadow root with the render result
923 /*
924 if (this._changedState.length) {
925 let element = this.localName;
926 if (this.id) {
927 element = `${element}#${this.id}`;
928 }
929 console.log("Re-rendering:", element, this._changedState.map(x => { // eslint-disable-line
930 let res = `${x.type}`;
931 if (x.reason) {
932 res = `${res}(${x.reason})`;
933 }
934 res = `${res}: ${x.name}`;
935 if (x.type === "property") {
936 res = `${res} ${JSON.stringify(x.oldValue)} => ${JSON.stringify(x.newValue)}`;
937 }
938
939 return res;
940 }));
941 }
942 */
943 this._changedState = [];
944
945 // Update shadow root
946 if (ctor._needsShadowDOM()) {
947 updateShadowRoot(this);
948 }
949 this._rendered = true;

Callers

nothing calls this directly

Calls 6

updateShadowRootFunction · 0.85
hasIndividualSlotsMethod · 0.80
getMetadataMethod · 0.80
fireEventMethod · 0.80
onBeforeRenderingMethod · 0.45
onAfterRenderingMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…