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

sync autosaves between loki and redux #2

Closed
wants to merge 28 commits into from

Conversation

Moocar
Copy link
Owner

@Moocar Moocar commented Nov 24, 2018

This PR orchestrates the saving of db state for both loki and redux into one place. Previously, loki would use its autosave feature and save to disk every 1000ms. Whereas now, it uses the same style as gatsby/redux where a debounced save is triggered for each new event.

Note that both database save asynchronously (redux's write to disk is async) so this isn't a perfect "Stop the world" synchronized save. However it's better than it was before.

Moocar and others added 27 commits November 25, 2018 08:55
…10024)

* feat(www): rebase Ecosystem and Blog sections

feat(www): add Ecosystem section to Homepage

feat(www): homepage WIP

wip

feat(www): finish sections style for mobile

feat(www): add Ecosystsem featured items to Hompage

feat(www): homepage ecosystem section styling WIP

feat(www): add arrow to action button

fix(www): fix code formating

fix(www): fix code formating and eslint errors

fix(www): fix hovering effect on Featured Item

fix(www): fix hovering effect sequel

fix(www): fix hover bug

fix(www): update texts (intro & link labels)

feat(www): add scroller observer to Home page

refactor(www): use imported scrollers observer

fix(www): change link labes on Ecosystem page

fix(www): fix some small style issues

refactor(www): refator combineEcosystemFeaturedItems and reorder some css properties

feat(www): add Blog section to Homepage

feat(www): mobile styles for Blog section

feat(www): mobile styles for Blog section

feat(www): desktoop style for Blog section WIP

feat(www): desktoop style for Blog section WIP

feat(www): desktop style for Homepage Blog section WIP

feat(www): finish desktop style of Blog section

feat(www): finish desktop style of Blog section

* fix(www): fix stylelint error

* feat(): finish styles of Blog section

* fix(www): add cover to one post for development

* fix(www): update margins for section action btns

* fix(www): update margins of Blog section

* refactor(www): email-cature-form

* refactor(www): email-cature-form

* feat(www): add ornaments to assets

* feat(www): update colors palette

* feat(www): add Homepage variant style to newsletter form

* feat(www): add Homepage variant style to newsletter form

* feat(www): mobile style for Homepage Newsletter section

* refactor(www): refactor homepage-section

* fix(www): fix homepage section padding

* refactor(www): refactor ecosystem scroollers

* fix(www): fix some styles

* fix(www): add cover image to one post

* fix(www): add border-radius to cover image

* fix(www): add automaticExcerpt if the handwritten one does not exists

* feat(www): add conditional formating to post dates

* fix(www): fix hover effect on Blog cards

* fix(www): remove 'Submit an article button'
This is the beginnings of a fix for gatsbyjs#4459

Right now, the fix works when excerpt_separator is provided. I have not yet implemented a fix for when the excerpt is generated using the `pruneLength` setting, though I have thoughts on how to solve it. My plan to is do a pre-order traversal over the html AST, accumulating nodes until the pruneLength is reached.

I would love some preliminary feedback to get a sense of how the contributors feel about this PR so far. Here are some of my initial thoughts:

1. The work in the `excerpt` resolve function is a little hacky. We are directly invoking a variety of functions get our HTML. I'm curious if anyone has a more streamlined approach for this.

2. We are invoking `getMarkdownAST` (previously getAST) twice, once for the excerpt and once for the entire page. I'm worried that this is going to break non-idempotent existing plugins since they will now run twice.

3. I tore apart the `getAST` function a bit and think I did a good job simplifying it. The big change is that we don't generate multiple promises anymore. i think this goes a long way towards improving readability.

I'd love to hear people's thoughts.
 - gatsby-image@2.0.21
 - gatsby-transformer-remark@2.1.13
 - gatsby@2.0.56
@greglobinski @amberleyromo 
Currently the second "View all posts" links to the homepage instead of the blog
<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
Added jacobdcastro.com to site showcase. 'Featured' set to 'false' and all possible YAML entries are filled out, even optional ones.
…tsbyjs#10107)

Without destructuring `activeClassName`, the <a> element will receive the prop and react will throw an error along the lines of `React does not recognize the `activeClassName` prop on a DOM element.`.

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
Update docs to show how state is passed through the location object.

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
Revert unintentional braking changes to style of the Newsletter form on Blog post pages applied during implementation of the same form presented on redesigned Hompage Newsletter section. 

- broken style 

![screenshot from 2018-11-28 13-54-21](https://user-images.githubusercontent.com/32480082/49153447-0b58d000-f316-11e8-9e75-213f74830768.png)

- fixed style (with this PR), the form looks the same as before refactoring of `www/src/components/email-capture-form.js`

![screenshot from 2018-11-28 13-53-55](https://user-images.githubusercontent.com/32480082/49153446-0ac03980-f316-11e8-929b-40e800ced254.png)
- Check if resources fail (as before)
- Upon any failure, render static HTML instead of dynamically rendering the children
  - Upon initial failure, reload the page and mark the path as failed
  - Upon second failure, don't reload the page and unflag it (since it might have just been a temporary failure and we want it to retry the next time)

Fixes gatsbyjs#10074
 - gatsby@2.0.57
…ials.com (gatsbyjs#10189)

Add two educational sites to showcase.

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
…ubplugins (gatsbyjs#9972)

This allow `gatsby-remark-*` subplugins to not have special error handling - `gatsby` will properly panic on build, but dev server won't crash anymore

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
 - babel-plugin-remove-graphql-queries@2.5.2
 - babel-preset-gatsby-package@0.1.3
 - babel-preset-gatsby@0.1.5
 - gatsby-cli@2.4.6
 - gatsby-codemods@1.0.8
 - gatsby-dev-cli@2.4.8
 - gatsby-image@2.0.22
 - gatsby-link@2.0.7
 - gatsby-plugin-canonical-urls@2.0.8
 - gatsby-plugin-catch-links@2.0.9
 - gatsby-plugin-coffeescript@2.0.7
 - gatsby-plugin-create-client-paths@2.0.3
 - gatsby-plugin-cxs@2.0.3
 - gatsby-plugin-emotion@2.0.7
 - gatsby-plugin-facebook-analytics@2.0.2
 - gatsby-plugin-feed@2.0.10
 - gatsby-plugin-fullstory@2.0.2
 - gatsby-plugin-glamor@2.0.7
 - gatsby-plugin-google-analytics@2.0.8
 - gatsby-plugin-google-gtag@1.0.8
 - gatsby-plugin-google-tagmanager@2.0.7
 - gatsby-plugin-guess-js@1.0.3
 - gatsby-plugin-jss@2.0.5
 - gatsby-plugin-layout@1.0.10
 - gatsby-plugin-less@2.0.8
 - gatsby-plugin-lodash@3.0.3
 - gatsby-plugin-manifest@2.0.11
 - gatsby-plugin-netlify-cms@3.0.9
 - gatsby-plugin-netlify@2.0.6
 - gatsby-plugin-nprogress@2.0.7
 - gatsby-plugin-offline@2.0.18
 - gatsby-plugin-page-creator@2.0.5
 - gatsby-plugin-postcss@2.0.2
 - gatsby-plugin-preact@2.0.8
 - gatsby-plugin-react-css-modules@2.0.4
 - gatsby-plugin-react-helmet@3.0.3
 - gatsby-plugin-remove-trailing-slashes@2.0.6
 - gatsby-plugin-sass@2.0.5
 - gatsby-plugin-sharp@2.0.14
 - gatsby-plugin-sitemap@2.0.3
 - gatsby-plugin-styled-components@3.0.4
 - gatsby-plugin-styled-jsx@3.0.3
 - gatsby-plugin-styletron@3.0.3
 - gatsby-plugin-stylus@2.0.3
 - gatsby-plugin-subfont@1.0.3
 - gatsby-plugin-twitter@2.0.8
 - gatsby-plugin-typescript@2.0.2
 - gatsby-plugin-typography@2.2.2
 - gatsby-react-router-scroll@2.0.2
 - gatsby-remark-autolink-headers@2.0.12
 - gatsby-remark-code-repls@2.0.2
 - gatsby-remark-copy-linked-files@2.0.7
 - gatsby-remark-custom-blocks@2.0.2
 - gatsby-remark-embed-snippet@3.1.1
 - gatsby-remark-graphviz@1.0.4
 - gatsby-remark-images@3.0.1
 - gatsby-remark-katex@3.0.1
 - gatsby-remark-prismjs@3.1.1
 - gatsby-remark-responsive-iframe@2.0.7
 - gatsby-remark-smartypants@2.0.7
 - gatsby-source-contentful@2.0.16
 - gatsby-source-drupal@3.0.12
 - gatsby-source-faker@2.0.3
 - gatsby-source-filesystem@2.0.10
 - gatsby-source-graphql@2.0.7
 - gatsby-source-hacker-news@2.0.7
 - gatsby-source-lever@2.0.2
 - gatsby-source-medium@2.0.2
 - gatsby-source-mongodb@2.0.9
 - gatsby-source-npm-package-search@2.0.2
 - gatsby-source-wikipedia@2.0.3
 - gatsby-source-wordpress@3.0.16
 - gatsby-transformer-csv@2.0.5
 - gatsby-transformer-documentationjs@2.0.2
 - gatsby-transformer-excel@2.1.4
 - gatsby-transformer-hjson@2.1.3
 - gatsby-transformer-javascript-frontmatter@2.0.5
 - gatsby-transformer-javascript-static-exports@2.1.4
 - gatsby-transformer-json@2.1.6
 - gatsby-transformer-pdf@1.0.15
 - gatsby-transformer-react-docgen@2.1.3
 - gatsby-transformer-remark@2.1.14
 - gatsby-transformer-screenshot@2.0.9
 - gatsby-transformer-sharp@2.1.9
 - gatsby-transformer-sqip@2.0.9
 - gatsby-transformer-toml@2.1.3
 - gatsby-transformer-xml@2.0.5
 - gatsby-transformer-yaml@2.1.6
 - gatsby@2.0.58
 - graphql-skip-limit@2.0.2
This PR adds a feature flag `GATSBY_DB_NODES` that can be used to change the storage engine for the gatsby data layer (`nodes`). 

- `redux` (default) which uses the existing redux implementation, and `sift` for querying. Or, you can use 
- `loki` which uses the loki in-memory database to store and query.

This PR re-implements functionality in gatsbyjs#9338, but with all tests passing and addressing previous feedback. It should also be easier to review since it builds on several refactorings. 

Some things to note:

1. I [submitted a PR to lokijs](techfort/LokiJS#718) which still hasn't been merged, though the author says he'll start working on it soon. Therefore, in in interim, I've published [@moocar/lokijs](https://www.npmjs.com/package/@moocar/lokijs). 
1. I haven't implemented auto indexing of query fields yet. I'll attack that next.
1. I suggest we ask the community to try out the feature flag once it's merged to get feedback. All the tests pass, but this is such a big change that we'll want to test it gradually
1. While loki uses the same mongo query language as sift, they do have different behavior. Most of my time on this PR was spent ensuring that loki behaves **exactly** like sift. See [db/loki/nodes-query.js](https://github.com/gatsbyjs/gatsby/blob/cddbe893a4ce638babb1cbe5e5da4c13b6f5e57d/packages/gatsby/src/db/loki/nodes-query.js). But there's a chance a few edge cases have slipped through the cracks.
1. the feature flag works with the tests too `GATSBY_DB_NODES=loki yarn test`. We should perhaps look into running this on all PRs
 - gatsby@2.0.59
…atsbyjs#10197)

<!--
  Q. Which branch should I use for my pull request?
  A. Use `master` branch (probably).

  Q. Which branch if my change is a bug fix for Gatsby v1?
  A. In this case, you should use the `v1` branch

  Q. Which branch if I'm still not sure?
  A. Use `master` branch. Ask in the PR if you're not sure and a Gatsby maintainer will be happy to help :)

  Note: We will only accept bug fixes for Gatsby v1. New features should be added to Gatsby v2.

  Learn more about contributing: https://www.gatsbyjs.org/docs/how-to-contribute/
-->
…than assign it. (gatsbyjs#9924)

The trailing slash stripping plugin [executes the function](https://github.com/gatsbyjs/gatsby/blob/f9714a5646523bc728586e3692190507ad68e6c1/packages/gatsby-plugin-remove-trailing-slashes/src/gatsby-node.js#L9) rather than just assigning it, so I'd imagine that's what the example code should be doing too.
* Created the page.

* Page content.

* Link in the blog post.

* Source attribution, language tweaks

* Fixed Prettier error.
…ing (gatsbyjs#10209)

* fix(gatsby-remark-prismjs): prevent additional blank line from appearing

* chore: don't use template literals; not needed

* test: update snapshots
@Moocar
Copy link
Owner Author

Moocar commented Nov 29, 2018

Closed and reopened against gatsby:master. gatsbyjs#10212

@Moocar Moocar closed this Nov 29, 2018
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.