Skip to content

When pressing the claim button in Rally, a js error occurs and claiming... message and cannot be completed. #19

@kaede-labs-jp

Description

@kaede-labs-jp

When pressing the claim button in Rally, a js error occurs and claiming... message and cannot be completed.

The following errors are displayed

index-a9d76da4.js:1444 Error: ended.
    at index-a9d76da4.js:1023:8961
    at async $ (index-a9d76da4.js:1444:5767)

The following is a description of where the js error is occurring.

function QLe({msg: e, onMsgLoaded: t, usersMap: n, isFixed: i, onFixClaim: r, scrolling: a}) {
    const s = Zt()
      , {curStageInfo: o, luckyDropStatuses: l, luckyDropDescs: u, userStageCoins: d, luckyDropClaimsNum: f, meIsHost: p, luckyDropClaimsAmount: h} = qe(Y=>Y.chat)
      , {user: m, userId: v} = qe(Y=>Y.user)
      , [y,g] = S.useState("Claimable")
      , [x,b] = S.useState(null)
      , [_,w] = S.useState(!1)
      , {luckyId: C, luckyType: E} = JSON.parse(e.content)
      , [T,A] = S.useState(null)
      , [k,M] = S.useState(!1)
      , [O,N] = S.useState(!1)
      , P = Qn()
      , R = l[C] ?? y
      , I = {
        LIGHT_UP_COIN: "Gems Airdrop for Rally",
        NEW_STAGE_COIN: "Gems for Boostrap Airdrop",
        OLE: "$OLE Airdrop",
        HOST_DROP: "Gems Airdrop from Host"
    }
      , {fire: L} = zne()
      , [j,D] = S.useState(!1)
      , B = S.useRef(null)
      , $ = async()=>{
        if (!(R !== "Claimable" || p && E == "HOST_DROP" && !lR.includes(v)) && !j && R === "Claimable") {
            D(!0);
            try {
                const Y = await Ge.stage.claimLuckyDrop({
                    stageId: o == null ? void 0 : o.stageId,
                    luckyDropId: C
                });
                Y && (L(),
                w(!0),
                g("Claimed"),
                s(bo({
                    id: C,
                    status: "Claimed"

The error message Error: ended typically indicates that a Promise or an asynchronous operation was prematurely terminated or did not resolve as expected. In the context of your code, this error could be originating from an asynchronous function or a Promise chain.

Looking at your code snippet, the most likely source of this error is the asynchronous function $ which is being used to claim a lucky drop. The error might be occurring due to the following reasons:

Network Issues: The request made by Ge.stage.claimLuckyDrop might be failing due to network issues or server-side problems.

Unhandled Promise Rejection: If the promise returned by Ge.stage.claimLuckyDrop is rejected and there's no .catch block to handle the rejection, it could lead to an unhandled promise rejection error.

Premature Termination: The function might be getting terminated before the promise is resolved or rejected, possibly due to a logic error in your code.

To troubleshoot and fix this error, you can try the following steps:

Check Network Requests: Use the network tab in your browser's developer tools to check if the request made by Ge.stage.claimLuckyDrop is successful or if it's failing due to some reason.

Add Error Handling: Ensure that you have proper error handling in place for the promise returned by Ge.stage.claimLuckyDrop. You can add a .catch block to handle any potential rejections:

const Y = await Ge.stage.claimLuckyDrop({
    stageId: o == null ? void 0 : o.stageId,
    luckyDropId: C
}).catch(error => {
    console.error("Error claiming lucky drop:", error);
    // Handle the error appropriately
});

Check for Logical Errors: Review the logic in your function to ensure that it's not getting terminated prematurely. Make sure that the conditions in your if statements are correct and that the function is allowed to complete its execution.

By following these steps, you should be able to identify and resolve the source of the Error: ended in your code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions