Skip to content

Add documentation and general guidance around using FASTElement #7516

Open

Description

@janechu

Description

There is currently some misunderstandings common to developers that are not addressed in the documentation. Some is covered in the MDN docs but could use elaboration.

Best practices list:

  • The constructor should primarily be used for setting up default values and assigning event handlers
  • The connectedCallback may fire while the constructor is still executing as the constructor is not blocking
  • The connectedCallback should be used for any component setup that is not related to the default values
  • Identify common scenarios and how to overcome them if data is coming in after default or initial values have been applied - an example of an indeterminate progress element may be useful here.
  • It is expected that change handlers for attributes and observed properties fire during initialization, from null to a value for attributes and undefined to a value for observed properties
    • Could there be a case for no-op on an observed property here during first run? This could avoid a conditional check.

Activity

  1. radium-v commented on May 13, 2026

    @radium-v
    Collaborator

    What's considered an initial value? an assignment in the constructor sets the value during construction, but an author may consider attributes present on the tag as being "initial values". These attribute values can't be set and won't fire observables until the connectedCallback finishes, since that fires against the opening tag (which is where those values exist).

  2. janechu commented on Jun 4, 2026

    @janechu
    CollaboratorAuthor

    What's considered an initial value? an assignment in the constructor sets the value during construction, but an author may consider attributes present on the tag as being "initial values". These attribute values can't be set and won't fire observables until the connectedCallback finishes, since that fires against the opening tag (which is where those values exist).

    I'll re-word, I mean default value (which is initial value but provides a better understanding).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docs:articleAdditions, improvements, or fixes to site articlesdocs:exampleTutorial and example work

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions