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

external data sources for pages #813

Merged
merged 16 commits into from
Jan 8, 2022

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Nov 30, 2021

Related Issue

resolves #21

You can test it out like so, using the name from the Artists API response

Screen Shot 2021-11-30 at 1 27 52 PM

Summary of Changes

  1. Added support for a "graph" API via plugins
  2. Added tests and documentation

TODOs

  1. build command + mpa optimization breaks (likely because now not all content is on disk)
         prerendering page... /artists/jay-st/
         prerendering page... /artists/various-artists/
         prerendering page... /artists/metal-wings/
         prerendering page... /artists/fave/
         prerendering complete for page /artists/various-artists/.
         (node:47671) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received null
             at validateString (internal/validators.js:124:11)
             at Object.extname (path.js:1318:5)
             at file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/src/plugins/resource/plugin-optimization-mpa.js:52:35
             at Array.map ()
             at file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/src/plugins/resource/plugin-optimization-mpa.js:51:12
             at new Promise ()
             at OptimizationMPAResource.optimize (file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/src/plugins/resource/plugin-optimization-mpa.js:41:12)
             at file:///Users/owenbuckley/Workspace/project-evergreen/repos/greenwood/packages/cli/src/lifecycles/prerender.js:19:18
             at runMicrotasks ()
             at processTicksAndRejections (internal/process/task_queues.js:95:5)
         
  2. build command + ssg mode renders incorrectly for home page, and artists pages don't exist?
  3. Add test cases
  4. Documentation
  5. Add minimum validation
  6. Remove demo code
  7. Discussion tracking - External Sources Local Development Workflows #839
    • cache external data to avoid excessive refetching, taking a React Query like approach (this feature can be post 1.0, IMO)
    • warn if two external sources match on the same route

@thescientist13 thescientist13 added CLI discussion tied to an ongoing discussion or meeting notes feature New feature or request labels Nov 30, 2021
@thescientist13 thescientist13 self-assigned this Nov 30, 2021
@thescientist13 thescientist13 force-pushed the feature/issue-21-external-data-sources branch from 0b1e1b5 to 1693539 Compare December 22, 2021 18:30
@thescientist13 thescientist13 marked this pull request as ready for review December 23, 2021 02:20
provider: () => {
return async function () {
// this could just as easily come from an API, DB, Headless CMS, etc
const artists = await fetch('http://www.myapi.com/...').then(resp => resp.json());
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this a good example, or maybe it would be best to keep it simple and just use a blog as the reference?

@thescientist13 thescientist13 force-pushed the feature/issue-21-external-data-sources branch from 5e7b824 to 53ff0ad Compare December 29, 2021 16:25
@thescientist13 thescientist13 removed their assignment Dec 29, 2021
@thescientist13 thescientist13 merged commit 6254fff into master Jan 8, 2022
@thescientist13 thescientist13 deleted the feature/issue-21-external-data-sources branch January 8, 2022 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Content as Data discussion tied to an ongoing discussion or meeting notes documentation Greenwood specific docs feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] External Data (Graph) Sources
1 participant