Skip to content

async-data-example #173

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

Merged
merged 2 commits into from
Dec 24, 2017
Merged

async-data-example #173

merged 2 commits into from
Dec 24, 2017

Conversation

bpostlethwaite
Copy link
Member

@nicolaskruchten @VeraZab this example is closer to the use case of a particular client's application. I think it is an important example as many real-world cases involve fetching data asynchronously.

Our current system using the hub and revisions is obviously cumbersome. I think this PR may make a good base to fix #172.

this.setState(prevState => ({
...prevState,
editorRevision,
plotRevision,
Copy link
Member Author

Choose a reason for hiding this comment

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

why does a user have to manage these things? Because we mutate data? I don't think that is a good enough excuse.

label: name,
}));
this.setState(prevState => ({...prevState, dataSourceOptions}));
this.hub.editorSourcesUpdated();
Copy link
Member Author

@bpostlethwaite bpostlethwaite Dec 16, 2017

Choose a reason for hiding this comment

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

really? So a user needs to know what is and what is not an editorSource and in each case make sure the hub is available in scope to call this function? really?

Copy link
Contributor

Choose a reason for hiding this comment

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

can this be done in the editor with componentWillReceiveProps()?

Copy link
Member Author

Choose a reason for hiding this comment

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

it can if figure updates always generate new wrapping containers.

dataSources,
...otherState,
});
this.hub.figureUpdated();
Copy link
Member Author

Choose a reason for hiding this comment

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

Oh and it's not just this.hub.editorSourcesUpdated() you need to keep track of, it's also somehow different from whatever figureUpdated() does. Nope and Nope.


onEditorUpdate(event) {
const {type, payload} = event;
if (type === EDITOR_ACTIONS.UPDATE_TRACES) {
Copy link
Member Author

Choose a reason for hiding this comment

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

And if we need to intercept the figure updating routine you gotta know how EDITOR_ACTIONS works and which events to tie into ... please 🙈

Copy link
Contributor

Choose a reason for hiding this comment

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

here we could invert control and have the hub fire its own sub-events that apps could hook into, so this would be implemented as hub.onUpdateTrace = ...

Copy link
Member Author

Choose a reason for hiding this comment

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

can we eliminate the hub entirely? It still seems a bit ungainly to me. It's a stateful thing but distinct from typical application data handling.

@bpostlethwaite
Copy link
Member Author

Okay a few scathing comments made. Extra scathing because I am solely responsible for this travesty. Who wants to take lead on figuring out and implementing a better system?

debug: true,
onUpdate: ({editorRevision, plotRevision}) =>
this.setState(prevState => ({
...prevState,
Copy link
Contributor

Choose a reason for hiding this comment

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

@bpostlethwaite why do we do this spread thing here? My understanding of setState was that it would merge anyway, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yes good call

@bpostlethwaite bpostlethwaite merged commit db45b70 into master Dec 24, 2017
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.

data management is currently a PITA. fix it.
2 participants