pnp / pnp/sp-dev-fx-controls-react

BUG: DynamicForm does not properly load lookup field when the webpart is not in the same site as the lists.

Open
#1,930 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted type:bug
Dominant language
TypeScript
Stars
433
Forks
418
Avg merge
5d 6m
Merged PRs (30d)
19

Description

When using DynamicForm component I set the webAbsoluteUrl to refer to the site where the list is located. If the list includes a lookup field and the webpart is running in a different site that webAbsoluteUrl, the lookup field fails to load lookup options and displays the error "Cannot read properties of undefined (reading 'TypeAsString')"

I assume that I need to pass a different context to the component. Any guidance on how best to do that? I do have an spfi object that corresponds to the webAbsolutUrl site.

<DynamicForm
webAbsoluteUrl={this.state.matterSiteUrl}
listId={this.state.matterListId}
onCancelled={() => { this.setState({ showNewMatter: false }) }}
onBeforeSubmit={this._matterOnBeforeSubmit}
onSubmitError={(listItem, error) => { console.log(error.message); }}
onSubmitted={async (listItemData) => {
await this._readMatterListItems();
await this._getSelectedMatter(this.state.matterlist);
}}
context={this.props.context}
/>

image

Category

[ ] Enhancement

[X] Bug

[ ] Question

Version

Please specify what version of the library you are using: [ 3.20.0 ]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the DynamicForm component and trace how webAbsoluteUrl, context, and lookup fields are used when loading a list from another site. Reproduce the issue with the supplied props and version 3.20.0; done means lookup options load without the TypeAsString error for a cross-site list.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.