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

[KED-1874] Move data loader into standalone-app entry point #215

Merged
merged 7 commits into from
Jul 9, 2020

Conversation

richardwestenra
Copy link
Contributor

@richardwestenra richardwestenra commented Jul 8, 2020

Description

  • Move data-source logic from initial-state: The test datasets aren't necessary in the exported component lib, and are only required when running the full app. So I've moved the data source loading functionality out of the App/initial-state logic
  • Replace window.location with document.location: This allows us to remove the typeof window checks, as document is available in build while window isn't.
  • Remove conditional window checks on svg-crowbar: These are no longer necessary as of svg-crowbar v0.4.0, updated in [Snyk] Upgrade svg-crowbar from 0.3.1 to 0.6.0 #208
  • Load json in src/index.js instead of App component: This simplifies the App component and moves unnecessary logic out of the exported library component
  • Allow an argument to be passed to loadJsonData: This will allow external users to load and run it if they wish. e.g.
import KedroViz from '@quantumblack/kedro-viz`;
import loadData from '@quantumblack/kedro-viz/lib/store/load-data';

loadData('/path/to/data.json').then(data => {
  ReactDOM.render(<KedroViz data={data} />, document.getElementById('root'));
});

QA notes

I've changed the componentDidUpdate check to not pay attention to the schema_id. Hopefully this won't change anything. Not sure why I didn't do this before.

Checklist

  • Read the contributing guidelines
  • Opened this PR as a 'Draft Pull Request' if it is work-in-progress
  • Updated the documentation to reflect the code changes
  • Added new entries to the RELEASE.md file
  • Added tests to cover my changes

Legal notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

  • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.

  • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorised to submit this contribution on behalf of the original creator(s) or their licensees.

  • I certify that the use of this contribution as authorised by the Apache 2.0 license does not violate the intellectual property rights of anyone else.

The test datasets aren't necessary in the exported component lib, and are only required when running the full app. So I've moved the data source loading functionality out of the App/initial-state logic
This allows us to remove the typeof window checks, as document is available in build while window isn't.
These are no longer necessary as of svg-crowbar v0.4.0, updated in #208
This simplifies the App component and moves unnecessary logic out of the exported library component
This will allow external users to load and run it if they wish
@richardwestenra richardwestenra requested a review from bru5 July 8, 2020 14:02
@richardwestenra richardwestenra self-assigned this Jul 8, 2020
@richardwestenra richardwestenra changed the title Refactor data loading [KED-1874] Move data loader into standalone-app entry point Jul 9, 2020
@richardwestenra richardwestenra requested a review from yetudada as a code owner July 9, 2020 11:49
@richardwestenra richardwestenra removed the request for review from yetudada July 9, 2020 13:26
@richardwestenra richardwestenra merged commit 9cb7adb into develop Jul 9, 2020
@richardwestenra richardwestenra deleted the refactor/initial-state branch July 9, 2020 13:26
@richardwestenra richardwestenra mentioned this pull request Sep 8, 2020
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants