Skip to content

Lightning-record-edit-form onLoad function firing incorrectly #4863

Open
@letti2017

Description

@letti2017

Description

Steps to Reproduce

  • Create a lightning-record-edit-form with a recordId, recordTypeId, and object-api-name filled out with an existing record
  • Use lightning-input-field with any fields on the specific object
  • Use the onLoad function provided for lightning-record-edit-form, then access the event.detail.record object that is returned, which should consistently have the list of fields (i.e. event.detail.record.fields) for the record specified in the lightning-record-edit-form
  • The event.detail.record.fields should consistently have the most up-to-date information on the fields provided in lightning-record-edit-form and should only fire once
<template>
	<lightning-record-edit-form
		object-api-name={objectApiName}
		record-id={recordId}
		record-type-id={recordTypeId}
		onload={onLoad}
	>
		<lightning-input-field
			field-name={fieldName}
			data-full-path-name={fieldDatabasePath}
		></lightning-input-field>
	</lightning-record-edit-form>
</template>
onLoad(event) {
	const record = event.detail.record;
	console.log(record.fields);
}

Expected Results

onLoad function in the above example only fires once and contains the most up-to-date information on the record provided in the html.

Actual Results

onLoad is fired inconsistently and may not contain the most up-to-date information, which can cause issues when using the event.detail.record to run specific rendering rules based on the values provided for the record.

Browsers Affected

All Browsers, all versions.

Version

  • LWC: v8.8.0

Activity

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

    External: Lightning ComponentsCategorizes issue or PR as related to Lightning base components.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions