Skip to content

Typescript SDK crashes when I32 is primary key #3299

@PastelStoic

Description

@PastelStoic

To reproduce, use the quickstart-chat demo app, but modify the Messages table in your module:

#[table(name = message, public)]
pub struct Message {
    #[auto_inc]
    #[primary_key]
    id: i32,
    sender: Identity,
    sent: Timestamp,
    text: String,
}

When the client receives a message, the call stack overflows due to an infinite loop.

From digging into the code, I found that the culprit was in src/lib/alebraic_type.ts, the intoMapKey function. That switch statement does not have a case for I32, so it falls back on the default, which triggers that loop.

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