Skip to content

Repeated queries get different results #10

@chmac

Description

@chmac

I'm using useProfile() and useNostrEvents(). I have a component to render profiles. It is called for the same user multiple times. But only 1 of the components gets either a profile or an event. The other components gets an empty array for .events.

Here's what I mean in pseudocode...

export const Profile = ({id}:{id: string}) => {
  const profileResult = useProfile({pubkey: id})
  return <div>{JSON.parse(profileResult)}</div>
}

export const Example = () => {
  <React.Fragment>
    <Profile
      id={"3e5dc1f1ed0ad1bd24055da9588a69d37d6eb983526c0fb12aff31199ed8f4b0"}
    />
    <Profile
      id={"3e5dc1f1ed0ad1bd24055da9588a69d37d6eb983526c0fb12aff31199ed8f4b0"}
    />
  </React.Fragment>;
};

In this example, the second component gets the profile, but the first gets undefined.

I tried swapping useProfile() for useNostrEvents() and constructing the query manually, but I get the same result.

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