Skip to content

Bug: useCustomSubscription changes loading value indefinitely  #251

@GuiLeme

Description

@GuiLeme

Describe the bug

When using the hook useCustomSubscription twice with the same subscription, loading property keeps changing value indefinitely.

Expected behavior

Whenever the hook is called, it should show loading true initially and when data comes, it should show loading false without ever changing it's value again.

Additional context

Code used to reproduce the error:

export const SCREENSHARE = `
  subscription Screenshare {
    screenshare {
      stream
    }
  }
`

export const useScreenshare = (pluginApi: PluginApi) => {
  const response = pluginApi.useCustomSubscription!<ScreenshareSubscriptionResult>(
    SCREENSHARE,
  );
  console.log(new Date().toISOString(), JSON.stringify({ response }));
  return response;
};

then the hook must be used in 2 different components.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions