Skip to content

Conversation

mohamedsalem401
Copy link
Member

No description provided.

super(props, opt);

const hasDataResolver = this.getDataResolver();
this.syncComponentsCollectionState();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to add this inside the condition below?

Comment on lines +48 to +58
protected listenToDataSource() {
const path = this.dataSourcePath;
if (!path) return;

const { em, collectionsStateMap } = this;
this.dataSourceWatcher = new DataResolverListener({
em,
resolver: new DataVariable({ type: DataVariableType, path }, { em, collectionsStateMap }),
onUpdate: () => this.onDataSourceChange(),
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also ensure to clear (from listeners) the previous this.dataSourceWatcher when this changes

Comment on lines +68 to +70
protected get dataSourceProps(): DataVariableProps | undefined {
return this.get('dataResolver');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above you have getDataResolver(), maybe let's replace this one with get dataResolverProps()?!

return this.get('dataResolver');
}

protected get dataSourcePath(): string | undefined {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe dataResolverPath is better

Comment on lines +107 to +113
dataListeners.push(
this.createListener(em, DataSourcesEvents.path, ({ path: eventPath }: { path: string }) => {
if (eventPath.startsWith(path)) {
this.onChange();
}
}),
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we really need this? 🤔

I guess I understand the reason behind it but it seems it could trigger too many unnecessary checks. When we add data components, I'd expect them to be already listening to the exact paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants