Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic form trying to load Image tags with wrong internal name #1422

Closed
Perneel opened this issue Jan 19, 2023 · 10 comments · Fixed by #1479
Closed

Dynamic form trying to load Image tags with wrong internal name #1422

Perneel opened this issue Jan 19, 2023 · 10 comments · Fixed by #1479
Assignees
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Milestone

Comments

@Perneel
Copy link

Perneel commented Jan 19, 2023

Category

[ ] Enhancement

[x] Bug

[ ] Question

Version

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

If you are not using the latest release, please update and see if the issue is resolved before submitting an issue.

Expected / Desired Behavior / Question

The form to open.

Observed Behavior

When the dynamic form is loading, I get a 400 bad request error. This is resulting in a spinner that keeps loading, no feedback to the user.

In developer tools (F12):
Request:
/_api/web/lists(@listId)/Fields/getByInternalNameOrTitle('MediaServiceImageTags_0')/InternalName?@listId=guid'thelistguid'
Response:
{"error":{"code":"-2147024809, System.ArgumentException","message":"Column 'MediaServiceImageTags_0' does not exist. It may have been deleted by another user."}}

If I inspect my list (SP Insider), the field with internal name MediaServiceImageTags_0 does not exist. However, MediaServiceImageTags does. Where do the fields get read from? As a work-around, is there a way to exclude fields from being added to the dynamic form?

Steps to Reproduce

Create a subsite in a site collection
Add a document library
Create a dynamic form with react

@ghost
Copy link

ghost commented Jan 19, 2023

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

@ghost ghost added the Needs: Triage 🔍 label Jan 19, 2023
@AJIXuMuK
Copy link
Collaborator

@Perneel - thank you for reporting the issue!
Could you please provide the configuration you're using to create a <DynamicForm>?

Thanks!

@Perneel
Copy link
Author

Perneel commented Jan 31, 2023

@AJIXuMuK , thanks for your response. The goal is to edit metadata of a selected file. Users provide documents in a library and with the help of a React webpart, they get an overview with a list of existing documents. If they select an item, metadata is shown together with the document itself in a custom viewer. By clicking the edit button, an edit form (dynamicform) opens in a Panel (fluent ui):

image

When I click on the edit button, I get the error message as shown in my original post and the form keeps showing the loading spinner.
The code for showing/hiding the panel is a simple boolean parameter.

const dialog = (selectedDocument) ?
    <Panel
      type={PanelType.medium}
      isOpen={!isDialogHidden}
      onDismiss={() => { closeEditForm(); }}
    >
      <DynamicForm
        context={props.context}
        listId={listId}
        listItemId={selectedDocument.id}
        onCancelled={() => { closeEditForm(); }}
        //onBeforeSubmit={async (listItem) => { return true; }}
        onSubmitError={(listItem, error) => { alert(error.message); }}
        onSubmitted={async (listItemData) => { console.log(listItemData); closeEditForm() }}
      />
    </Panel>
    : <></>;

@martinlingstuyl
Copy link
Contributor

martinlingstuyl commented Feb 28, 2023

I'm experiencing the same @AJIXuMuK, @Perneel,

On my dev-tenant, when creating a new list with new Taxonomy Columns, things work as expected.
But on another tenant, the display names of the taxonomy note fields are the same as their internal names.
There is no Field_0 to find.

The problem seems to be in this line:

const response = await this._spService.getTaxonomyFieldInternalName(this.props.listId, field.InternalName, this.webURL);

@martinlingstuyl
Copy link
Contributor

martinlingstuyl commented Feb 28, 2023

The point is that the code makes the assumption that the corresponding note field has a specific display name. Which is not always the case.

I worked around it by updating the display names of the note fields to <internalNameOfTaxField>_0. In other words, what the code expects it to be.

But this is probably not watertight.

martinlingstuyl added a commit to martinlingstuyl/sp-dev-fx-controls-react that referenced this issue Feb 28, 2023
martinlingstuyl added a commit to martinlingstuyl/sp-dev-fx-controls-react that referenced this issue Feb 28, 2023
martinlingstuyl added a commit to martinlingstuyl/sp-dev-fx-controls-react that referenced this issue Feb 28, 2023
@martinlingstuyl
Copy link
Contributor

I've created a PR to fix this @joelfmrodrigues, 🤙

@joelfmrodrigues
Copy link
Collaborator

@martinlingstuyl just saw that, super quick turnaround, many thanks!
Will try to review and test later today/tomorrow

@martinlingstuyl
Copy link
Contributor

You've got to forge the iron while it's hot, they say over here 😁

@joelfmrodrigues joelfmrodrigues added the status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. label Feb 28, 2023
joelfmrodrigues added a commit that referenced this issue Mar 1, 2023
Fixes DynamicForm trying to load TaxonomyFields with wrong display name. Closes #1422
@joelfmrodrigues joelfmrodrigues added status:fixed-next-drop Issue will be fixed in upcoming release. and removed status:working-on-it Known issue / feature being addressed. Will use other "status:*" labels & comments for more detail. labels Mar 1, 2023
@joelfmrodrigues joelfmrodrigues added this to the 3.14.0 milestone Mar 1, 2023
@joelfmrodrigues
Copy link
Collaborator

@Perneel the PR from Martin has been merged and the fix should be available in the beta release within a few minutes. If you have the chance to test it at your end, please let us know if all is resolved.

@Perneel
Copy link
Author

Perneel commented Mar 1, 2023

@joelfmrodrigues , I have just tested it with the beta release (3.14.0-beta.4302330) and can confirm that the DynamicForm is loading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:fixed-next-drop Issue will be fixed in upcoming release. type:bug
Projects
None yet
4 participants