ProjectEvergreen / greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.
https://www.greenwoodjs.io
MIT License
97 stars 9 forks source link

Rfc/issue 952 data loading strategies #1157

Closed thescientist13 closed 11 months ago

thescientist13 commented 1 year ago

Related Issue

resolves #952

Summary of Changes

  1. Add async loader function constructor props for SSR pages request time data (aka getServerSideProps)
  2. (breaking) Refactor / rename getFrontmatter.static -> export const prerender = true (aka getStaticProps)
  3. Added documentation for loader Web Server Components (WSCs) and export const prerender
  4. (breaking) Refactor plugin-graphql
    • Closer ESM compat (now no more need for Rollup aliases)
    • Document / validate prerender: true / custom imports alternative to Puppeteer
  5. Upgrade wcc@0.9.0

TODO

  1. [x] equivalent for getStaticPaths - I think this depends on landing #882 , so will need to track there instead
  2. [x] Adopt non-loader implementation of data fetching
  3. [ ] Align Greenwood and WCC on data loading behavior - https://github.com/ProjectEvergreen/wcc/pull/120
  4. [x] Need to do anything for adapters?
  5. [x] address PR feedback

Thoughts / Questions

  1. [x] loaders pattern vs RSC flavor page components? - https://github.com/ProjectEvergreen/greenwood/pull/1157/files#r1349748857
  2. [x] GraphQL thoughts - should we keep it?
  3. [x] Graph refactoring (or own issue?) - https://github.com/ProjectEvergreen/greenwood/issues/1167
    • rename imports field to resources in frontmatter for graph
    • Change graph.json from path -> url (instance of URL)
    • Make graph an actual graph (edges + nodes). What's the best data structure for this? Otherwise should we not call it a graph.json?
    • How to vanilla fetch the graph without GraphQL? Come in as compilation props?
  4. [x] Rethink SSR pages API (getFrontmatter, getTemplates, getBody, etc) - will save this for #955
  5. [x] context plugins as part of SSR (for pages and templates work?) - tracking in #955
  6. [x] refactor context, move all things into manifest.json - tracking in #955
  7. [x] Deprecate Custom Elements flavor of Include Plugin? - made a note of this to revisit this