Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add flag to keep working old observables till explroer reaches prod #934

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/@dcl/sdk/src/observables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ export interface IEvents {
}
}

// Remove this once new components/observables reaches production.
const __OBSERVABLES_FALLBACK_SUPPORT = true
/**
* @internal
* This function generates a callback that is passed to the Observable
* constructor to subscribe to the events of the DecentralandInterface
*/
function createSubscriber(eventName: keyof IEvents) {
return () => {
if (eventName === 'comms' || (globalThis as any).__OBSERVABLES_FALLBACK_SUPPORT) {
if (eventName === 'comms' || __OBSERVABLES_FALLBACK_SUPPORT) {
subscribe({ eventId: eventName }).catch(console.error)
} else {
SDK7ComponentsObservable?.subscribe(eventName)
Expand Down Expand Up @@ -263,7 +265,7 @@ export async function pollEvents(sendBatch: (body: ManyEntityAction) => Promise<

const SDK7ComponentsObservable = processObservables()
function processObservables() {
if ((globalThis as any).__OBSERVABLES_FALLBACK_SUPPORT) return
if (__OBSERVABLES_FALLBACK_SUPPORT) return
const subscriptions = new Set<keyof IEvents>()

function subscribe(eventName: keyof IEvents) {
Expand Down
Loading