-
Notifications
You must be signed in to change notification settings - Fork 1
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
improve data events #84
improve data events #84
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/carto-frontend/web-sdk/msi1n2rwv |
34b9426
to
951dc3e
Compare
src/lib/viz/layer/Layer.ts
Outdated
@@ -21,6 +22,16 @@ import { FunctionFilterApplicator } from '../filters/FunctionFilterApplicator'; | |||
import { ColumnFilters } from '../filters/types'; | |||
import { basicStyle } from '../style/helpers/basic-style'; | |||
|
|||
const DATA_READY_EVENT = 'layer:data:ready'; |
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.
deckgl uses 'camelCase', so how about 'layerDataReady'?
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.
Ok, I have not a real preference
src/lib/viz/layer/Layer.ts
Outdated
|
||
function buildInitialDataState() { | ||
return { | ||
isFirstTime: true, |
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.
If we join 'isPanning' / 'isZooming'... we might consider using an enum instead of a set of flags, so only 1 state is possible at the same time...
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.
Yep, I think it is possible to do so
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.
Done in 2 steps if you want to follow the code
7523706
to
8dc2177
Compare
@@ -94,6 +107,7 @@ export class Layer extends WithEvents implements StyledLayer { | |||
|
|||
if (this._deckLayer) { | |||
await this.replaceDeckGLLayer(); | |||
this.dataState = DATA_STATES.STARTING; |
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.
This is applied to setSource
. Would it be also necessary with setStyle
?
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.
No, it would not because data does not change with setStyle
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.
LGTM. Small suggestion of renaming 'layerDataReady' --> 'dataReady'
fix https://app.clubhouse.io/cartoteam/story/92672/map-refine-map-related-data-events
The idea is to create a state object which is responsible of:
The objectives are:
By now it is also emitting the previous one
viewportLoad
which is used by dataviews, but the idea is to change to the new ones.