web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / UpdateView ran before ...
Power Apps
Unanswered

UpdateView ran before container is created

(1) ShareShare
ReportReport
Posted on by 38

I am facing a sequencing issue here.

My control type is virtual because I am using React so I suppose there is no container parameter here.

Nevertheless, my code could not render because it initialized before the HTML div container is created as per the screenshot above. Once the container is created, however, the updateview does not rerun.

public init(
    context: ComponentFramework.Context<IInputs>,
    notifyOutputChanged: () => void,
    state: ComponentFramework.Dictionary,
    container: HTMLDivElement
  ): void {
    this._container = container;
    console.log("Container assigned:", this._container);

    const observer = new MutationObserver((mutationsList, observer) => {
      const htmlContainer = document.querySelector(
        ".container"
      ) as HTMLDivElement;
      if (htmlContainer) {
        console.log("Container detected in MutationObserver:", htmlContainer);
        this._container = htmlContainer;
        observer.disconnect();
        notifyOutputChanged();
      } else {
        console.warn("Container not found in MutationObserver.");
      }
    });
    observer.observe(document.body, { childList: true, subtree: true });
  }

  /**
   * Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, offline status, control metadata values such as label, visible, etc.
   * @param context The entire property bag 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
   * @returns ReactElement root react element for the control
   */
  public updateView(
    context: ComponentFramework.Context<IInputs>
  ): React.ReactElement {
    if (!this._container) {
      console.warn(
        "PCF Container not available yet. Retrying...",
        this._container
      );
    }
    console.log("PCF Container available ", this._container);
    return React.createElement(heremapsrender);
  }
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard