Skip to content

Fix `useProp` and context in case of synchronization edge without definition or mounting order.

Compare
Choose a tag to compare
@UpperCod UpperCod released this 01 Mar 01:51
· 37 commits to master since this release

Thanks to @WickyNilliams who detected that:

  1. useProp did not correctly reflect the state of the prop in v1.76 #126
  2. useContext did not reflect the state of the context when declaring the consumer before using customElements.defined.

Important

The use of context preferably requires a synchronous order of customElements.defined declarations or the use of customElements.whenDefined if the parent working as the provider fails to transmit information to the children. Example:

// Synchronous declaration example
customElements.define("my-context", MyContext);
customElements.define("my-parent", MyParent);
customElements.define("my-child", MyChild);

// customElements.whenDefined example
customElements.whenDefined("my-parent").then(() => {
  customElements.define("my-child", CounterValue);
});