Skip to content

This Library Stops working with Popular FluentUI Blazor library version 4.13+ #13

Description

@htmlsplash

As of the release of fluentui-blazor 4.13 or later, your JS library breaks.

The error occurs in this routine:

function reviveJSComponentArgs(key, value) { if (value && typeof value === "object" && value.hasOwnProperty(jsElementReferenceScopeKey)) { const collectionId = value[jsElementReferenceScopeKey]; const elements = document.querySelectorAll([data-ref|="${collectionId}"]`);
const result = {};
for (const element of elements) {
const attributeValue = element.getAttribute('data-ref');
const startIndex = attributeValue.indexOf('-') + 1;
const elementRefId = attributeValue.substring(startIndex);
result[elementRefId] = element;
}

        return result;
    }

    return value;
}`

The first if statement falsely assumes that the "value" hasOwnProperty and throws:

value.hasOwnProperty is not a function TypeError: value.hasOwnProperty is not a function at reviveJSComponentArgs (BlazorJSComponents.bcdqxdgmpp.lib.module.js:113:57) at blazor.web.js:1:2806 at Array.reduce (<anonymous>) at Array.<anonymous> (blazor.web.js:1:2791) at JSON.parse (<anonymous>) at v (blazor.web.js:1:2773) at b.processJSCall (blazor.web.js:1:4409) at b.beginInvokeJSFromDotNet (blazor.web.js:1:4129) at Cn._invokeClientMethod (blazor.web.js:1:68829) at Cn._processIncomingData (http://localhost:5221/_framework/blazor.web.js:1:66188) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, JSCallType callType, Object[] args) at Microsoft.JSInterop.JSObjectReferenceExtensions.InvokeVoidAsync(IJSObjectReference jsObjectReference, String identifier, Object[] args) at Microsoft.FluentUI.AspNetCore.Components.FluentMenu.OnAfterRenderAsync(Boolean firstRender) at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

For more details and example repo to be able to reproduce this bug view this issue here:
microsoft/fluentui-blazor#4488

Please update us if you will be fixing this problem and when so at least we know what to do.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions