qlik-oss / qlik-api-ts

Typescript types and Javascript library for consuming Qlik API's
https://qlik.dev
ISC License
8 stars 3 forks source link

qix createBookmarkEx argument error #69

Closed Milio-sudo closed 1 week ago

Milio-sudo commented 1 week ago

Issue: Unable to Use CreateBookmarkEx Method in QIX API

Description

While using the QIX API to create bookmarks with soft patches, we are unable to use the CreateBookmarkEx method. Regardless of the parameter set in prop, the parameter actually sent by the code is always true.

Logs

Below are some logs showing what is sent by the WebSocket (the function had prop parameters):

SENT: {"delta":true,"handle":1,"method":"CreateBookmarkEx","params":[true,null],"id":45,"jsonrpc":"2.0"}
RECEIVED: {"jsonrpc":"2.0","id":45,"error":{"code":-32700,"parameter":"Unexpected JSON token","message":"JSON parse error"}}

As you can see the first parameter is replaced by true.

Investigation

I found that in the file @qlik/api/chunks/LIPAU4N5.js, the first parameter is always replaced by true (at line 9769):

createBookmark(_createBookmark, props) {
  return _createBookmark(
    merge2(
      {},
      {
        qInfo: {
          qType: "bookmark"
        },
        qMetaDef: {
          title: "",
          description: ""
        },
        creationDate: (/* @__PURE__ */ new Date()).toISOString()
      },
      props
    )
  );
},
createBookmarkEx(_createBookmarkEx, props, patchObjs) {
  return _createBookmarkEx(
    merge2(
      true,
      {
        qInfo: {
          qType: "bookmark"
        },
        qMetaDef: {
          title: "",
          description: ""
        },
        creationDate: (/* @__PURE__ */ new Date()).toISOString()
      },
      props
    ),
    patchObjs
  );
}

Solution

Setting this parameter to {} as in the regular createBookmark version resolves the issue.

Question

Is there a specific reason for this behavior in the createBookmarkEx method?

nilzona commented 1 week ago

@Milio-sudo Looks like you found a bug. We will fix and release a new version.

nilzona commented 1 week ago

Fixed by #70