Skip to content

Issue while calling *.upsert() after *.end() #71

@volodymyrdn

Description

@volodymyrdn

Hi there. I have a short story to test the library:

import { StoryFn } from "@storybook/react-vite";
import { createCallable } from "react-call";
export default {
    title: "Dialog",
}

interface Props { message: string }
type Response = boolean

const MyDialog = createCallable<Props, Response>(({ call, message }) => {
    return (
        <div>
            <p>{message}</p>
            <button onClick={() => call.end(true)}>Yes</button>
            <button onClick={() => call.end(false)}>No</button>
        </div>
    )
})

const Template: StoryFn = () => {
    return (
        <>
            <button onClick={() => MyDialog.upsert({ message: new Date().toLocaleString() })}>Upsert Dialog</button >
            <button onClick={() => MyDialog.end(false)}>End Dialog</button>
            <MyDialog.Root />
        </>
    )
}

export const Primary: StoryFn = Template.bind({})
  1. When I click Upsert Dialog button for the first time, the dialog is inserted as expected.
  2. When I click Upsert Dialog button for the second time, the dialog is updated as expexted.
  3. When I click End Dialog button, the dialog disappears as expected.
  4. When I click Upsert Dialog button for the third time, the dialog is not inserted.

What am I doing wrong? Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions