-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Pages datasources #6601
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
base: dev
Are you sure you want to change the base?
Pages datasources #6601
Conversation
packages/core/src/data_sources/model/ComponentWithCollectionsState.ts
Outdated
Show resolved
Hide resolved
super(props, opt); | ||
|
||
const hasDataResolver = this.getDataResolver(); | ||
this.syncComponentsCollectionState(); |
There was a problem hiding this comment.
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?
packages/core/test/specs/data_sources/model/data_collection/ComponentDataCollection.ts
Outdated
Show resolved
Hide resolved
packages/core/test/specs/dom_components/model/ComponentWrapper.ts
Outdated
Show resolved
Hide resolved
packages/core/test/specs/dom_components/model/ComponentWrapper.ts
Outdated
Show resolved
Hide resolved
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(), | ||
}); | ||
} |
There was a problem hiding this comment.
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
protected get dataSourceProps(): DataVariableProps | undefined { | ||
return this.get('dataResolver'); | ||
} |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe dataResolverPath
is better
dataListeners.push( | ||
this.createListener(em, DataSourcesEvents.path, ({ path: eventPath }: { path: string }) => { | ||
if (eventPath.startsWith(path)) { | ||
this.onChange(); | ||
} | ||
}), | ||
); |
There was a problem hiding this comment.
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.
No description provided.