-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix: Several Fixes for Scroll Handling and Restoration #24306
Conversation
A related question to this is that I don't know if we should let |
685e732
to
36bcdbd
Compare
36bcdbd
to
8c3cbe5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @blainekasten! This is a long-standing issue. For me POP does not restore scrollPosition
is not working, it always resets to 0 for me.
Seems like key isn't updating on popstate. Probably because scroll is called in between.
const STATE_KEY_PREFIX = `@@scroll|` | ||
const GATSBY_ROUTER_SCROLL_STATE = `___GATSBY_REACT_ROUTER_SCROLL` | ||
|
||
export default class SessionStorage { | ||
read(location, key) { | ||
export class SessionStorage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make this separate functions instead of a class for modification, something for a future PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we maybe pass this to gatsby-browser functions. Something to consider
@@ -0,0 +1,65 @@ | |||
import React from "react" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a TODO to remove this in the next major? I don't see any usage of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just for consumer usage. But once we support hooks, the hook approach should be the default. So yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Ward Peeters <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
@wardpeet wanna give it another test? I found a bug that I fixed. It seems to be working for me now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks! A few more
@wardpeet finally came back around to this and fixed everything up. Think it should be good to ship now! Take another review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @blainekasten ! LGTM
…ker da det ga litt rar oppførsel og ikke er anbefalt av gatsby måtte implementere litt custom greier da dette ikke ser ut til å virke ut av boksen med gatsby gatsbyjs/gatsby#21120 https://codingcat.dev/blog/anchor-links-from-sanity-in-gatsby/#sanityio https://stackoverflow.com/questions/24665602/scrollintoview-scrolls-just-too-far trodde egentlig denne PR'en skulle fikse det, men ser ikke at det funker..? gatsbyjs/gatsby#24306
Heads up: this doesn't appear to have made it into the changelog, so it's hard to see which version of Gatsby this is fixed for. |
@coreyward Fixed this in the above commit. Thanks for the call out. It was added in 2.23.5! |
* feat(gatsby-recipes): Pass data retrieved from the resource to its children via context * chore(gatsby-recipes): Swap out Promise.all for a true queue * feat(gatsby-recipes): Implement a render loop for nested resources * Continue spiking out recipes gui * Hardcode the project root in a clear place for now * Join plan steps in order to create entire recipe plan at once + initial efforts on GUI * WIP * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource * chore(gatsby-recipes): Use an INVALID_PROP event for schema validation * feat(gatsby-recipes): Wrap intro and each step with components, add metadata * chore(gatsby-recipes): Spike out basic gui component for steps * feat(gatsby-recipes): Pass data retrieved from the resource to its children via context * chore(gatsby-recipes): Swap out Promise.all for a true queue * feat(gatsby-recipes): Implement a render loop for nested resources * Continue spiking out recipes gui * Hardcode the project root in a clear place for now * Join plan steps in order to create entire recipe plan at once + initial efforts on GUI * WIP * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource * chore(gatsby-recipes): Use an INVALID_PROP event for schema validation * feat(gatsby-recipes): Wrap intro and each step with components, add metadata * chore(gatsby-recipes): Spike out basic gui component for steps * Lots of styling changes * Put text & resources in same steps * Lots more styling tweaks * paragraphs had too much margin bottom * more style tweaks * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource Also adds the use of an INVALID_PROP event for schema validation. * chore(gatsby-recipes): Use MDX v2 canary for access to the JSX AST * feat(gatsby-recipes): Apply a UUID prop to all resources for input handling * checkin: Begin wiring up event for passing input data to server * fix(gatsby-recipes): Update step wrapping for MDX v2 * fix(gatsby-recipes): Get tests passing, add debugging output * Get applying working * PROGRESSSSS * feat(gatsby-recipes): Allow for inputs based on uuid to override props * Remove sleep * style tweaks * Add updater to input provider, spike out File form * feat(gatsby-recipes): Implement basic input functionality * feat(gatsby-recipes): Spike out a contentful space resource, use renderer for applying plan * feat(gatsby-recipes): Spike out contentful provider and basic rendering (#24655) * feat(gatsby-recipes): Spike out contentful provider and basic rendering * Update packages/gatsby-recipes/src/gui.js * WIP * More design tweaks * Style inline code * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * feat(gatsby-recipes): fix MDX rendering for exports (#25133) * feat(gatsby-recipes): Handle exports, render MDX directly * Continue working towards proper exports * Continue implementing MDX renderer v2 * More MDX rendering hacking * Finish basic export handling * Small fixes Co-authored-by: John Otander <[email protected]> * live updating is working more-or-less * Speedups & cleanups * Rename hook to match signature * Rename context * Add support for useResourceByKey * fix @babel/template not accepting integers as options * Only update resources when it's changed * make child Resource components work * rename useResourceByKey -> useResource * Implement ContentfulEntry resource * Add useProvider & ensure only apply resource once * Address some design feedback * Fix spacing for input forms * Fix spacing and size of step indicator * Flatten nested resources in display * Use input builtins from gatsby-interface * Add special file diff * Get things running again * Reload recipe session on changes - when the recipe file is updated - when the recipe api is restarted - when the browser is refreshed. * Update tests * Only emit updates when the state has actually changed * Fix building recipe component * update resolutions/dependencies * fix fetch dependency * moer fixes * Upgrade to Ink v3 & start migrating cli to showing all steps * Properly handle nested resources when rendering the plan (#25930) * Don't hardcode port * Ensure that nested resource get resourceName populated * feat(gatsby-recipes): Refactor CLI UI for new one-shot show plan (#25939) * feat(gatsby-recipes): Refactor CLI UI for new one-shot show plan * Restore experimental message + showing list of recipes to run * Add a --develop command for hot-reloading of recipes * Add --install command support * Remove unused code + old pre Ink v3 logging system * Cleanup + show step count * Remove console.log * add key * small fixes + add script to start dev server * Add dev instructions for running the recipes graphql server in the foreground * small fixes * @babel/standalone caches transforms unless you delete the require cache * fix linting problems * Extract shared code into common library * Checkin useInput beginning * Ensure that diff html isn't rendered by escaping * Update providers snapshots, looked like they weren't run with chalk turned off * Update other snapshots as well * Begin fixing some lint errors * Fix some more lint errors * Fix grabbing the right resource Co-authored-by: John Otander <[email protected]> * move back to v2 for deploying for compatability with the regular CLI * Also do a compatability layer for <Box> * test * Add missing dependency * sad * Add rollup to bundle the cli app so we can use Ink v3 * Move packages packed by rollup to be dev dependencies as user won't need to download them * Remove console.logs * Remove logs * feat(gatsby-recipes): copy edits for some recipes (#26009) * Fix rendering li > p * Fix formatting of emotion recipe * Improve recipe * Name of key changed * Match keyed resources correctly in the install step + cleanups * Fix linting errors * fix margin * Surround inlineCode with back ticks so it looks like markdown * vendor ink-link as it's not upgraded to v3 yet * feat(gatsby-recipes) (#26085) * prettier file * Fix linting errors * feat(gatsby-recipes): fix recipes copy 2 (#26115) * feat(gatsby-recipes) * second half of copy edits donezo! * feat(gatsby-source-shopify): Add shopifyShop query (#25763) * Start moving gatsby-telemetry to typescript (#25812) * Fix camelCase * Start moving gatsby-telemetry to ts * Continue converting base to typescript * Debug transpilation issues * Debug transpilation issues * Fix telemetry tests * Add Changelog entry for merged PR #24306 * chore(gatsby-telemetry): Migrate is-truthy to TypeScript (#25884) * Detect vercel again after rebranding in gatsby-telemetry (#25883) * Detect vercel again after rebranding as per https://vercel.com/docs/v2/build-step * Add another Vercel NOW matcher * chore(gatsby-telemetry): Migrate flush to TypeScript (#25886) * feat(gatsby-source-shopify): set link from product variant to product (#25316) * fix: update www (#25874) Co-authored-by: Renovate Bot <[email protected]> * docs(gatsby-internals): update page -> node dependency tracking (#25606) * docs(gatsby-internals): update page -> node dependency tracking * Apply suggestions from code review Co-authored-by: Aisha Blake <[email protected]> * remove surplus `and` from performance comma list (#25891) * fixed typo (#25896) * fix(gatsby): Support symlinks in static directories (#25894) * Added the link to 'MDX' (#25905) * Update localization-i18n.md (#25902) Some important links for **React-intl** had broken due to update in repo whose links were given. Added the correct links to it. * added a cookieflags option (#25907) Co-authored-by: Thijs van Diessen <[email protected]> * fix(readme): gatsby-source-shopify: unify variable names (#25882) * chore(showcase): Add MongoDB Developer Hub (#25892) * Add file names to code blocks (#25879) * enhancement(docs): dictionary.txt -> CodePen -> fix brand name (#25875) * feat(gatsby-admin): list all pages of site (#25744) * feat(gatsby-admin): plugin search (#25903) * Copy plugin search from www into admin * Move to Combobox search * Cleanup * TypeScript cleanup * add algolia types * Fix syntax * fix: Restore CLI port in use prompt feature (#25863) * fix: Restore CLI port in use prompt feature Seems like it got accidentally removed during a big PR? * fix: Ensure port var types are the same The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`. Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility. * Fix/follow up 25863 (#25915) * fix: Restore CLI port in use prompt feature Seems like it got accidentally removed during a big PR? * fix: Ensure port var types are the same The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`. Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility. * Force program.port to a number early Co-authored-by: polarathene <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * Capture repositoryId from heroku (#25910) * Capture repositoryId from heroku * Add comments * fixed typo (#25912) * Update README.md (#25901) No need to link to `example.com` it's a sample domain. * Add __BASE_PATH__ definition to storybook config (#25643) * Add __BASE_PATH__ definition to storybook config * Globals need not be defined for Storybook Docs Update to Docs: Removes the need to declare the `__BASE_PATH__` and `__PATH_PREFIX__` in the Storybook config for Tests to work * fix(gatsby): don't place virtual modules in node_modules directory (#25720) * fix(gatsby): don't place virtual modules in node_modules directory * fix eslint rule Co-authored-by: Ward Peeters <[email protected]> * chore(doc):Add guide to Deploy Gatsby to DigitalOcean droplet. (#24652) * Added doc for deploying to digitalocean droplet Added doc for deploying gatsby site to digitalocean droplet and configuring domain name with SSL. For issue #24549 . * Updated with deploying to digitalocean droplet doc Updated with deploying to digitalocean droplet doc to fix issue #24549. * Added missing code language flag to fix lint check Lint Check failed due to one code language flag was missing in one of the code snippet in the md file. Fixed that. * Updated grammar and styles as per code review Co-authored-by: Marcy Sutton <[email protected]> * Removed the line for brevity * Updated grammar change for line #11 as per code review * Ran prettier to format the code * Added step to install dependencies after cloning * Change case of node to Node as per suggestion. Co-authored-by: Marcy Sutton <[email protected]> * Changing optional to required for installing version of Node Gatsby required Node 10, so making the use of n package while installing the Node on digitalocean as a REQUIRED step. Co-authored-by: Marcy Sutton <[email protected]> * Adding suggested changes for better understanding. Co-authored-by: Marcy Sutton <[email protected]> * Adding the suggested changes. Using "Generate your Gatsby site for production" instead of "Build your gatsby site to generate static site for production" Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per suggestion by moderator Making the docs style changes as suggested by moderator marcysutton Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per suggestion Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Update docs/docs/deploying-to-digitalocean-droplet.md Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Adding path resemble line to make it easy for people to understand the path Co-authored-by: Marcy Sutton <[email protected]> * Adding changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Added snippet to get rid of permission denied Added snippet to get rid of permission denied while cloning the repository * Adding indentation as per linting rules * Ran prettier * Updating grammar as per suggested Co-authored-by: Marcy Sutton <[email protected]> * Added note to copy local repo path for future ref * Ran prettier to format the code Co-authored-by: Marcy Sutton <[email protected]> * Update migrating-from-v1-to-v2.md (#25832) * fix dictionary for digitalocean guide (#25936) * fix(docs): show where `getNodesByType` comes from (#25344) * show where getNodesByType comes from * indicate the code is an example per PR feedback Co-authored-by: Marcy Sutton <[email protected]> Co-authored-by: Marcy Sutton <[email protected]> * chore(docs): Changes to "Setting Up Your Local Dev Environment" doc (#25721) * chore(gatsby): add log to gatsby develop if Admin is enabled (#25943) * feat(gatsby): Defer node mutation during querying (#25479) * Move bootstrap into machine * Add parent span and query extraction * Add rebuildSchemaWithSitePage * Use values from context * Remove logs * Add redirectListener * Changes from review * Log child state transitions * Add state machine for query running * Changes from review * Changes from review * Switch to reporter * Use assertStore * Remove unused action * Remove unusued config * Remove unusued config * Add gql runner reset * Handle node mutation queuing and batching in state machine * Use new pagedata utils * Use develop queue * New xstate syntax * Work-around xstate bug * Track first run * Track first run * Disable --quiet in e2e * Don't defer node mutation if we're outside the state machine * Re-quieten e2e * Listen for query file changes * Lint * Handle webhook * Changes from review * Fix typings * Changes from review * Typefix * feat(gatsby): Move final parts into develop state machine (#25716) * Move remaining parts into state machine * Move top level state machine into state machines dir * Add machine ids * Add missing imports * Resolve api promises * Remove unused action * Move logging into helper * Changes from review * Manually save db * Add comments * Remove first run from query running * Refactor into separate data layer machines * Fix condition Co-authored-by: gatsbybot <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * fix(docs): Fix broken mdx (#25946) * chore(gatsby-admin): build in postbuild of gatsby instead of prepublish (#25940) * Move admin to postbuild of gatsby * Remove prepublish gatsby-admin build * Dont run tests in .cache * Ignore _tests_ in .cache * Use local copy of Gatsby to build gatsby-admin * perf(gatsby-source-contentful): speed up resolving of huge spaces (#25954) closes #25464 * docs: use hello-world starter in quick start guide instead of default starter (#25914) * Small tweak to see if we can reduce errors driven by the default starter using and its dependency on sharp. * chore: format * Reverted working directory name A change to address feedback about changing the name to preserve continuity with current manual recipes. Co-authored-by: gatsbybot <[email protected]> * chore(docs): Fix RFC typo (#25970) * chore(gatsby-admin): cleanup stale artifacts pre build (#25972) * Handle webpack in state machine (#25815) Co-authored-by: gatsbybot <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] * fix(gatsby-admin): show error messages in the interface (#25944) * docs(gatsby-admin): more detailed architecture explanation (#25941) * Write more detailed Admin architecture docs * Add section on production deployment to gatsby-admin docs * Absolute URLs so they work on npm etc. * Fix pronouns and wording * Clean up some more * Tighten up language around production deployment Co-authored-by: Brent Jackson <[email protected]> * Update packages/gatsby-admin/README.md Co-authored-by: Brent Jackson <[email protected]> Co-authored-by: Brent Jackson <[email protected]> * fix(gatsby): call predicate for the root ancestor in findRootNodeAncestor (#25974) * fix(gatsby-admin): small design tweaks (#25971) * feat(gatsby): Add internal types export (#25921) * Handle webpack in state machine * Add internal export * feat(plugin-manifest): support SVG favicon (#25276) Co-authored-by: Yogi <[email protected]> * maintenance(www) remove unused dependencies (#25463) Co-authored-by: Aisha Blake <[email protected]> * Update contributor-swag.md (#25980) Based on a recent increase in the volume of requests, I'm updating how people can request their free Gatsby swag for contributions that aren't made on GitHub. * feat(gatsby-source-filesystem): improve wrong url rejection message (#25965) * feat(gatsby-source-filesystem: improve wrong url rejection message The existing message made tracing down a bug from within the new WP source plugin harder than necessary. Old message: `wrong url: ${url}` Updated message: `url passed to createRemoteFileNode is either missing or not a proper web uri: ${url}` * chore: format * update rejects test to match new message Co-authored-by: gatsbybot <[email protected]> * Also detect VERCEL_BUILDER should Vercel one day use it as per the docs (#25926) * fix(babel-preset-gatsby): enable transformer-regenerator (#25983) * fix(docs): bash to shell (#25958) * change bash to shell * dont change text file code language * chore: add tests to static-query filepaths (#25978) * chore: add tests to static-query filepaths * fix windows paths * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * highlighted plugins (#25998) * Revert "perf(gatsby-plugin-mdx): drop another babel step during sourcing" (#26002) This reverts commit 6d0c791. * fix: Enable CLI integration tests (#25997) * [docs][glossary] add new entry for client-side rendering (#25984) * add new glossary entry for client-side routing * update text to address rendering vs. routing * Add link to page, rather than anchor Co-authored-by: Hashim Warren <[email protected]> * fix: do not augment plugin-options (#26006) * fix(gatsby-recipes) Fix docs for name in NPMPackage * fix: update www (#26043) Co-authored-by: Renovate Bot <[email protected]> * Added extra markup (#26030) * Added extra markup I found some js code which was not highlighted so I wrapped it in js code block, secondly, I added the link to reach/router as it was confusing if its react/router or reach/router * added the link to reach/router * Update glossary.md * chore(showcase): Add leanier.com site (#26016) * Add support for cache refresh via GraphiQL (#25960) * Add cache refresh button * Formatting * Explicit return type * www: Remove sw (#26054) * Docs: Add a warning about static queries (#25929) * feat(gatsby): Add top-level error handling to state machine (#25995) * chore: Update stale yarn.lock (#26068) * tests(gatsby): Add unit tests for develop state machine (#26051) * feat(gatsby): Add top-level error handling to state machine * Add initial tests * Add tests for top-level machine * Test error handling * Add post-bootstrap to tests * chore(showcase): Add johnkavanagh.co.uk (#25747) * chore(showcase): Minor changes Showcase Tatjana Volbeke Portfolio (#25613) * fix(gatsby): Defer node mutation in more APIs (#26067) * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * chore(showcase): add Julien Karst website (#25682) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(showcase): BRIKL & TRUE STORY in showcase (#25631) * chore(showcase): BRIKL & TRUE STORY in showcase * chore(showcase): run prettier sites.yml Co-authored-by: Obinna Ekwuno <[email protected]> * chore(blog): Add i18n theme blog post (#26065) * add blog post * fix linting * put head in code tag lol * chore(showcase): add Château de Morey 🏰 (#25683) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(showcase): meetup.com (#25792) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(gatsby): fix typegen for publishing (#26078) * chore(gatsby): add typescript as dev dependency * chore(gatsby): run typegen after rimraf * fix(gatsby): Delete babel and terser cache dirs (#26053) * Delete babel and terser cache dirs * Clean up yarn lock * fix yarn.lock (?) * verbose gatsby-dev * chore(gatsby): add typescript as dev dependency * Update e2e-test.sh * chore(gatsby): run typegen after rimraf Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: gatsbybot <[email protected]> * fix(gatsby): Load static query results from its own Db (#26077) * Load static query results from its own Db * Keep StaticQueryContext because it is public API * Switch to an Object for static query results from a Map * Move getStaticQueryResults to private API * chore(release): Publish - [email protected] - [email protected] * fix(gatsby-image): add required check for one of fluid or fixed (#25371) * Do not crash the page if the image component is invoked without parameters * added a warning if missing fluid and fixed props * had swapped a condition * doing destructuring in function parameter list * now with functioning tree-shaking * updating function doc: returns undefined, not null * switching to proptypes for validation * Update packages/gatsby-image/src/index.js Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Ward Peeters <[email protected]> * fix(gatsby): Load resources in ProdPageRenderer (#26092) * Load resources in ProdPageRenderer * Add simple unit tests * chore(release): Publish - [email protected] - [email protected] - [email protected] * Update gatsby in www * Add plugincreator to API (#26101) * Add plugincreator to API * fix capitlization Co-authored-by: Laurie Barth <[email protected]> * chore(showcase): Add Devnet (#25952) Co-authored-by: Obinna Ekwuno <[email protected]> * Add pluagin source for page (#26104) Co-authored-by: Laurie Barth <[email protected]> * fix(gatsby-source-contentful): support height parameter for srcset (#25776) * Calculate fixed image width if necessary * Calculate fixed image width if necessary * Revert snapshot test changes * Bring back new test * Update snapshot * chore(docs): Add author Colby Fayock (#26109) * adding Colby Fayock author avatar and bio * Update author.yaml adding new line at end of file * pretier * Use commonmark option to better handle list parsing * revert fixpack changes to root package.json * Squashed commit of the following: commit 33aff39 Author: Kyle Mathews <[email protected]> Date: Thu Jul 30 13:09:59 2020 -0700 Update index.md * Actually fix lint error * Fix test * more fixing tests * Only log when DEBUG=true * Remove --quiet to see errors * Add rollup * resolve conflicts * remove testing code * Make yarn.lock file valid * WORK PLEASE * Add yoga-layout-prebuilt as explicit dependency to make rollup + yarn 2.0 happy * Add node-fetch as dependency * Update packages/gatsby-recipes/src/graphql-server/server.js Co-authored-by: Peter van der Zee <[email protected]> * Use string matching for NPMPackage versions * Add missing string matcher * Fix lint error * Add missing normalize.css dep Co-authored-by: John Otander <[email protected]> Co-authored-by: Marcy Sutton <[email protected]> Co-authored-by: shannonbux <[email protected]> Co-authored-by: Paul Scanlon <[email protected]> Co-authored-by: Jarmo Isotalo <[email protected]> Co-authored-by: Blaine Kasten <[email protected]> Co-authored-by: Johnny Zabala <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: Aisha Blake <[email protected]> Co-authored-by: Michael Murphy <[email protected]> Co-authored-by: Dawood Sadiq <[email protected]> Co-authored-by: James Brooks <[email protected]> Co-authored-by: Haseeb Khan <[email protected]> Co-authored-by: Ankit Ghosh <[email protected]> Co-authored-by: Thijs <[email protected]> Co-authored-by: Thijs van Diessen <[email protected]> Co-authored-by: Muescha <[email protected]> Co-authored-by: Jordan Stapinski <[email protected]> Co-authored-by: Max Stoiber <[email protected]> Co-authored-by: Brennan Kinney <[email protected]> Co-authored-by: Nabeel Valley <[email protected]> Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Vatsal Mistry <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: Kurt Tomlinson <[email protected]> Co-authored-by: Lennart <[email protected]> Co-authored-by: Matt Kane <[email protected]> Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Benedikt Rötsch <[email protected]> Co-authored-by: Joel Smith <[email protected]> Co-authored-by: Brent Jackson <[email protected]> Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: Alex Moon <[email protected]> Co-authored-by: Yogi <[email protected]> Co-authored-by: Nat Alison <[email protected]> Co-authored-by: Laci-Texter <[email protected]> Co-authored-by: Tyler Barnes <[email protected]> Co-authored-by: LB <[email protected]> Co-authored-by: Hashim Warren <[email protected]> Co-authored-by: anubhavmeet <[email protected]> Co-authored-by: Dan Kirkham <[email protected]> Co-authored-by: Sidhartha Chatterjee <[email protected]> Co-authored-by: John Kavanagh <[email protected]> Co-authored-by: Julius <[email protected]> Co-authored-by: Julien Karst <[email protected]> Co-authored-by: Obinna Ekwuno <[email protected]> Co-authored-by: Tobias Meixner <[email protected]> Co-authored-by: Andy Stanberry <[email protected]> Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Laurie Barth <[email protected]> Co-authored-by: Marin Matošević <[email protected]> Co-authored-by: Sean Baines <[email protected]> Co-authored-by: Colby Fayock <[email protected]> Co-authored-by: Peter van der Zee <[email protected]>
@wardpeet @blainekasten I'm not 100% sure but I suspect that API changes included in this merged PR have introduced issues with shouldUpdateScroll browser API. It also seems the browser API documentation on It appears the scroll position is no longer saved in session storage as an [x, y] array, but rather as a single number for y position. All the Gatsby sites I've built with with animated page transitions no longer successfully restore scroll position on pop state — instead the user is always returned to the top of the page on browser back/forward. Up till now I've use this code snippet in
After digging it appears the getSavedScrollPosition now requires both location and location.key as arguments, and returns a single number rather than x/y coordinates. So I've updated to this:
But unfortunately that update doesn't solve the issue either. It also seems that the scroll position is logged at a different time in the route change process because by the time it's called above (even with setTimeout delay matching the page transition speed), the savedYPosition comes back as This simple gatsby-browser trick used to work every time, as long as the setTimeout delay matches the speed of the page transition. Now it never seems to work. I couldn't find anything in the changelog that shed any light on the issue but found this PR as I browsed through the history of the files related to scroll handling and restoration. |
A little more info — I was able to get the scroll restoration to work on popstate using the following workaround code that accesses the session storage directly instead of using
|
@blimpmason can you open an issue cause merged Prs are hardly checked |
Co-authored-by: Ward Peeters <[email protected]>
* feat(gatsby-recipes): Pass data retrieved from the resource to its children via context * chore(gatsby-recipes): Swap out Promise.all for a true queue * feat(gatsby-recipes): Implement a render loop for nested resources * Continue spiking out recipes gui * Hardcode the project root in a clear place for now * Join plan steps in order to create entire recipe plan at once + initial efforts on GUI * WIP * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource * chore(gatsby-recipes): Use an INVALID_PROP event for schema validation * feat(gatsby-recipes): Wrap intro and each step with components, add metadata * chore(gatsby-recipes): Spike out basic gui component for steps * feat(gatsby-recipes): Pass data retrieved from the resource to its children via context * chore(gatsby-recipes): Swap out Promise.all for a true queue * feat(gatsby-recipes): Implement a render loop for nested resources * Continue spiking out recipes gui * Hardcode the project root in a clear place for now * Join plan steps in order to create entire recipe plan at once + initial efforts on GUI * WIP * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource * chore(gatsby-recipes): Use an INVALID_PROP event for schema validation * feat(gatsby-recipes): Wrap intro and each step with components, add metadata * chore(gatsby-recipes): Spike out basic gui component for steps * Lots of styling changes * Put text & resources in same steps * Lots more styling tweaks * paragraphs had too much margin bottom * more style tweaks * feat(gatsby-recipes): Implement a wait for input state when props are missing for a resource Also adds the use of an INVALID_PROP event for schema validation. * chore(gatsby-recipes): Use MDX v2 canary for access to the JSX AST * feat(gatsby-recipes): Apply a UUID prop to all resources for input handling * checkin: Begin wiring up event for passing input data to server * fix(gatsby-recipes): Update step wrapping for MDX v2 * fix(gatsby-recipes): Get tests passing, add debugging output * Get applying working * PROGRESSSSS * feat(gatsby-recipes): Allow for inputs based on uuid to override props * Remove sleep * style tweaks * Add updater to input provider, spike out File form * feat(gatsby-recipes): Implement basic input functionality * feat(gatsby-recipes): Spike out a contentful space resource, use renderer for applying plan * feat(gatsby-recipes): Spike out contentful provider and basic rendering (gatsbyjs#24655) * feat(gatsby-recipes): Spike out contentful provider and basic rendering * Update packages/gatsby-recipes/src/gui.js * WIP * More design tweaks * Style inline code * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * Update packages/gatsby-recipes/recipes/cypress.mdx Co-authored-by: Marcy Sutton <[email protected]> * feat(gatsby-recipes): fix MDX rendering for exports (gatsbyjs#25133) * feat(gatsby-recipes): Handle exports, render MDX directly * Continue working towards proper exports * Continue implementing MDX renderer v2 * More MDX rendering hacking * Finish basic export handling * Small fixes Co-authored-by: John Otander <[email protected]> * live updating is working more-or-less * Speedups & cleanups * Rename hook to match signature * Rename context * Add support for useResourceByKey * fix @babel/template not accepting integers as options * Only update resources when it's changed * make child Resource components work * rename useResourceByKey -> useResource * Implement ContentfulEntry resource * Add useProvider & ensure only apply resource once * Address some design feedback * Fix spacing for input forms * Fix spacing and size of step indicator * Flatten nested resources in display * Use input builtins from gatsby-interface * Add special file diff * Get things running again * Reload recipe session on changes - when the recipe file is updated - when the recipe api is restarted - when the browser is refreshed. * Update tests * Only emit updates when the state has actually changed * Fix building recipe component * update resolutions/dependencies * fix fetch dependency * moer fixes * Upgrade to Ink v3 & start migrating cli to showing all steps * Properly handle nested resources when rendering the plan (gatsbyjs#25930) * Don't hardcode port * Ensure that nested resource get resourceName populated * feat(gatsby-recipes): Refactor CLI UI for new one-shot show plan (gatsbyjs#25939) * feat(gatsby-recipes): Refactor CLI UI for new one-shot show plan * Restore experimental message + showing list of recipes to run * Add a --develop command for hot-reloading of recipes * Add --install command support * Remove unused code + old pre Ink v3 logging system * Cleanup + show step count * Remove console.log * add key * small fixes + add script to start dev server * Add dev instructions for running the recipes graphql server in the foreground * small fixes * @babel/standalone caches transforms unless you delete the require cache * fix linting problems * Extract shared code into common library * Checkin useInput beginning * Ensure that diff html isn't rendered by escaping * Update providers snapshots, looked like they weren't run with chalk turned off * Update other snapshots as well * Begin fixing some lint errors * Fix some more lint errors * Fix grabbing the right resource Co-authored-by: John Otander <[email protected]> * move back to v2 for deploying for compatability with the regular CLI * Also do a compatability layer for <Box> * test * Add missing dependency * sad * Add rollup to bundle the cli app so we can use Ink v3 * Move packages packed by rollup to be dev dependencies as user won't need to download them * Remove console.logs * Remove logs * feat(gatsby-recipes): copy edits for some recipes (gatsbyjs#26009) * Fix rendering li > p * Fix formatting of emotion recipe * Improve recipe * Name of key changed * Match keyed resources correctly in the install step + cleanups * Fix linting errors * fix margin * Surround inlineCode with back ticks so it looks like markdown * vendor ink-link as it's not upgraded to v3 yet * feat(gatsby-recipes) (gatsbyjs#26085) * prettier file * Fix linting errors * feat(gatsby-recipes): fix recipes copy 2 (gatsbyjs#26115) * feat(gatsby-recipes) * second half of copy edits donezo! * feat(gatsby-source-shopify): Add shopifyShop query (gatsbyjs#25763) * Start moving gatsby-telemetry to typescript (gatsbyjs#25812) * Fix camelCase * Start moving gatsby-telemetry to ts * Continue converting base to typescript * Debug transpilation issues * Debug transpilation issues * Fix telemetry tests * Add Changelog entry for merged PR gatsbyjs#24306 * chore(gatsby-telemetry): Migrate is-truthy to TypeScript (gatsbyjs#25884) * Detect vercel again after rebranding in gatsby-telemetry (gatsbyjs#25883) * Detect vercel again after rebranding as per https://vercel.com/docs/v2/build-step * Add another Vercel NOW matcher * chore(gatsby-telemetry): Migrate flush to TypeScript (gatsbyjs#25886) * feat(gatsby-source-shopify): set link from product variant to product (gatsbyjs#25316) * fix: update www (gatsbyjs#25874) Co-authored-by: Renovate Bot <[email protected]> * docs(gatsby-internals): update page -> node dependency tracking (gatsbyjs#25606) * docs(gatsby-internals): update page -> node dependency tracking * Apply suggestions from code review Co-authored-by: Aisha Blake <[email protected]> * remove surplus `and` from performance comma list (gatsbyjs#25891) * fixed typo (gatsbyjs#25896) * fix(gatsby): Support symlinks in static directories (gatsbyjs#25894) * Added the link to 'MDX' (gatsbyjs#25905) * Update localization-i18n.md (gatsbyjs#25902) Some important links for **React-intl** had broken due to update in repo whose links were given. Added the correct links to it. * added a cookieflags option (gatsbyjs#25907) Co-authored-by: Thijs van Diessen <[email protected]> * fix(readme): gatsby-source-shopify: unify variable names (gatsbyjs#25882) * chore(showcase): Add MongoDB Developer Hub (gatsbyjs#25892) * Add file names to code blocks (gatsbyjs#25879) * enhancement(docs): dictionary.txt -> CodePen -> fix brand name (gatsbyjs#25875) * feat(gatsby-admin): list all pages of site (gatsbyjs#25744) * feat(gatsby-admin): plugin search (gatsbyjs#25903) * Copy plugin search from www into admin * Move to Combobox search * Cleanup * TypeScript cleanup * add algolia types * Fix syntax * fix: Restore CLI port in use prompt feature (gatsbyjs#25863) * fix: Restore CLI port in use prompt feature Seems like it got accidentally removed during a big PR? * fix: Ensure port var types are the same The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`. Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility. * Fix/follow up 25863 (gatsbyjs#25915) * fix: Restore CLI port in use prompt feature Seems like it got accidentally removed during a big PR? * fix: Ensure port var types are the same The CLI option and default value for `port` is a string, despite the TypeScript typing the arg to `number`. Unclear if `port` should be a `number` elsewhere, so checking for and converting to a number within the utility. * Force program.port to a number early Co-authored-by: polarathene <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * Capture repositoryId from heroku (gatsbyjs#25910) * Capture repositoryId from heroku * Add comments * fixed typo (gatsbyjs#25912) * Update README.md (gatsbyjs#25901) No need to link to `example.com` it's a sample domain. * Add __BASE_PATH__ definition to storybook config (gatsbyjs#25643) * Add __BASE_PATH__ definition to storybook config * Globals need not be defined for Storybook Docs Update to Docs: Removes the need to declare the `__BASE_PATH__` and `__PATH_PREFIX__` in the Storybook config for Tests to work * fix(gatsby): don't place virtual modules in node_modules directory (gatsbyjs#25720) * fix(gatsby): don't place virtual modules in node_modules directory * fix eslint rule Co-authored-by: Ward Peeters <[email protected]> * chore(doc):Add guide to Deploy Gatsby to DigitalOcean droplet. (gatsbyjs#24652) * Added doc for deploying to digitalocean droplet Added doc for deploying gatsby site to digitalocean droplet and configuring domain name with SSL. For issue gatsbyjs#24549 . * Updated with deploying to digitalocean droplet doc Updated with deploying to digitalocean droplet doc to fix issue gatsbyjs#24549. * Added missing code language flag to fix lint check Lint Check failed due to one code language flag was missing in one of the code snippet in the md file. Fixed that. * Updated grammar and styles as per code review Co-authored-by: Marcy Sutton <[email protected]> * Removed the line for brevity * Updated grammar change for line gatsbyjs#11 as per code review * Ran prettier to format the code * Added step to install dependencies after cloning * Change case of node to Node as per suggestion. Co-authored-by: Marcy Sutton <[email protected]> * Changing optional to required for installing version of Node Gatsby required Node 10, so making the use of n package while installing the Node on digitalocean as a REQUIRED step. Co-authored-by: Marcy Sutton <[email protected]> * Adding suggested changes for better understanding. Co-authored-by: Marcy Sutton <[email protected]> * Adding the suggested changes. Using "Generate your Gatsby site for production" instead of "Build your gatsby site to generate static site for production" Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per suggestion by moderator Making the docs style changes as suggested by moderator marcysutton Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per suggestion Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Update docs/docs/deploying-to-digitalocean-droplet.md Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Adding path resemble line to make it easy for people to understand the path Co-authored-by: Marcy Sutton <[email protected]> * Adding changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Making changes as per the suggestion Co-authored-by: Marcy Sutton <[email protected]> * Added snippet to get rid of permission denied Added snippet to get rid of permission denied while cloning the repository * Adding indentation as per linting rules * Ran prettier * Updating grammar as per suggested Co-authored-by: Marcy Sutton <[email protected]> * Added note to copy local repo path for future ref * Ran prettier to format the code Co-authored-by: Marcy Sutton <[email protected]> * Update migrating-from-v1-to-v2.md (gatsbyjs#25832) * fix dictionary for digitalocean guide (gatsbyjs#25936) * fix(docs): show where `getNodesByType` comes from (gatsbyjs#25344) * show where getNodesByType comes from * indicate the code is an example per PR feedback Co-authored-by: Marcy Sutton <[email protected]> Co-authored-by: Marcy Sutton <[email protected]> * chore(docs): Changes to "Setting Up Your Local Dev Environment" doc (gatsbyjs#25721) * chore(gatsby): add log to gatsby develop if Admin is enabled (gatsbyjs#25943) * feat(gatsby): Defer node mutation during querying (gatsbyjs#25479) * Move bootstrap into machine * Add parent span and query extraction * Add rebuildSchemaWithSitePage * Use values from context * Remove logs * Add redirectListener * Changes from review * Log child state transitions * Add state machine for query running * Changes from review * Changes from review * Switch to reporter * Use assertStore * Remove unused action * Remove unusued config * Remove unusued config * Add gql runner reset * Handle node mutation queuing and batching in state machine * Use new pagedata utils * Use develop queue * New xstate syntax * Work-around xstate bug * Track first run * Track first run * Disable --quiet in e2e * Don't defer node mutation if we're outside the state machine * Re-quieten e2e * Listen for query file changes * Lint * Handle webhook * Changes from review * Fix typings * Changes from review * Typefix * feat(gatsby): Move final parts into develop state machine (gatsbyjs#25716) * Move remaining parts into state machine * Move top level state machine into state machines dir * Add machine ids * Add missing imports * Resolve api promises * Remove unused action * Move logging into helper * Changes from review * Manually save db * Add comments * Remove first run from query running * Refactor into separate data layer machines * Fix condition Co-authored-by: gatsbybot <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * fix(docs): Fix broken mdx (gatsbyjs#25946) * chore(gatsby-admin): build in postbuild of gatsby instead of prepublish (gatsbyjs#25940) * Move admin to postbuild of gatsby * Remove prepublish gatsby-admin build * Dont run tests in .cache * Ignore _tests_ in .cache * Use local copy of Gatsby to build gatsby-admin * perf(gatsby-source-contentful): speed up resolving of huge spaces (gatsbyjs#25954) closes gatsbyjs#25464 * docs: use hello-world starter in quick start guide instead of default starter (gatsbyjs#25914) * Small tweak to see if we can reduce errors driven by the default starter using and its dependency on sharp. * chore: format * Reverted working directory name A change to address feedback about changing the name to preserve continuity with current manual recipes. Co-authored-by: gatsbybot <[email protected]> * chore(docs): Fix RFC typo (gatsbyjs#25970) * chore(gatsby-admin): cleanup stale artifacts pre build (gatsbyjs#25972) * Handle webpack in state machine (gatsbyjs#25815) Co-authored-by: gatsbybot <[email protected]> * chore(release): Publish - [email protected] - [email protected] - [email protected] * fix(gatsby-admin): show error messages in the interface (gatsbyjs#25944) * docs(gatsby-admin): more detailed architecture explanation (gatsbyjs#25941) * Write more detailed Admin architecture docs * Add section on production deployment to gatsby-admin docs * Absolute URLs so they work on npm etc. * Fix pronouns and wording * Clean up some more * Tighten up language around production deployment Co-authored-by: Brent Jackson <[email protected]> * Update packages/gatsby-admin/README.md Co-authored-by: Brent Jackson <[email protected]> Co-authored-by: Brent Jackson <[email protected]> * fix(gatsby): call predicate for the root ancestor in findRootNodeAncestor (gatsbyjs#25974) * fix(gatsby-admin): small design tweaks (gatsbyjs#25971) * feat(gatsby): Add internal types export (gatsbyjs#25921) * Handle webpack in state machine * Add internal export * feat(plugin-manifest): support SVG favicon (gatsbyjs#25276) Co-authored-by: Yogi <[email protected]> * maintenance(www) remove unused dependencies (gatsbyjs#25463) Co-authored-by: Aisha Blake <[email protected]> * Update contributor-swag.md (gatsbyjs#25980) Based on a recent increase in the volume of requests, I'm updating how people can request their free Gatsby swag for contributions that aren't made on GitHub. * feat(gatsby-source-filesystem): improve wrong url rejection message (gatsbyjs#25965) * feat(gatsby-source-filesystem: improve wrong url rejection message The existing message made tracing down a bug from within the new WP source plugin harder than necessary. Old message: `wrong url: ${url}` Updated message: `url passed to createRemoteFileNode is either missing or not a proper web uri: ${url}` * chore: format * update rejects test to match new message Co-authored-by: gatsbybot <[email protected]> * Also detect VERCEL_BUILDER should Vercel one day use it as per the docs (gatsbyjs#25926) * fix(babel-preset-gatsby): enable transformer-regenerator (gatsbyjs#25983) * fix(docs): bash to shell (gatsbyjs#25958) * change bash to shell * dont change text file code language * chore: add tests to static-query filepaths (gatsbyjs#25978) * chore: add tests to static-query filepaths * fix windows paths * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * highlighted plugins (gatsbyjs#25998) * Revert "perf(gatsby-plugin-mdx): drop another babel step during sourcing" (gatsbyjs#26002) This reverts commit 6d0c791. * fix: Enable CLI integration tests (gatsbyjs#25997) * [docs][glossary] add new entry for client-side rendering (gatsbyjs#25984) * add new glossary entry for client-side routing * update text to address rendering vs. routing * Add link to page, rather than anchor Co-authored-by: Hashim Warren <[email protected]> * fix: do not augment plugin-options (gatsbyjs#26006) * fix(gatsby-recipes) Fix docs for name in NPMPackage * fix: update www (gatsbyjs#26043) Co-authored-by: Renovate Bot <[email protected]> * Added extra markup (gatsbyjs#26030) * Added extra markup I found some js code which was not highlighted so I wrapped it in js code block, secondly, I added the link to reach/router as it was confusing if its react/router or reach/router * added the link to reach/router * Update glossary.md * chore(showcase): Add leanier.com site (gatsbyjs#26016) * Add support for cache refresh via GraphiQL (gatsbyjs#25960) * Add cache refresh button * Formatting * Explicit return type * www: Remove sw (gatsbyjs#26054) * Docs: Add a warning about static queries (gatsbyjs#25929) * feat(gatsby): Add top-level error handling to state machine (gatsbyjs#25995) * chore: Update stale yarn.lock (gatsbyjs#26068) * tests(gatsby): Add unit tests for develop state machine (gatsbyjs#26051) * feat(gatsby): Add top-level error handling to state machine * Add initial tests * Add tests for top-level machine * Test error handling * Add post-bootstrap to tests * chore(showcase): Add johnkavanagh.co.uk (gatsbyjs#25747) * chore(showcase): Minor changes Showcase Tatjana Volbeke Portfolio (gatsbyjs#25613) * fix(gatsby): Defer node mutation in more APIs (gatsbyjs#26067) * chore(release): Publish - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] * chore(showcase): add Julien Karst website (gatsbyjs#25682) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(showcase): BRIKL & TRUE STORY in showcase (gatsbyjs#25631) * chore(showcase): BRIKL & TRUE STORY in showcase * chore(showcase): run prettier sites.yml Co-authored-by: Obinna Ekwuno <[email protected]> * chore(blog): Add i18n theme blog post (gatsbyjs#26065) * add blog post * fix linting * put head in code tag lol * chore(showcase): add Château de Morey 🏰 (gatsbyjs#25683) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(showcase): meetup.com (gatsbyjs#25792) Co-authored-by: Obinna Ekwuno <[email protected]> * chore(gatsby): fix typegen for publishing (gatsbyjs#26078) * chore(gatsby): add typescript as dev dependency * chore(gatsby): run typegen after rimraf * fix(gatsby): Delete babel and terser cache dirs (gatsbyjs#26053) * Delete babel and terser cache dirs * Clean up yarn lock * fix yarn.lock (?) * verbose gatsby-dev * chore(gatsby): add typescript as dev dependency * Update e2e-test.sh * chore(gatsby): run typegen after rimraf Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: gatsbybot <[email protected]> * fix(gatsby): Load static query results from its own Db (gatsbyjs#26077) * Load static query results from its own Db * Keep StaticQueryContext because it is public API * Switch to an Object for static query results from a Map * Move getStaticQueryResults to private API * chore(release): Publish - [email protected] - [email protected] * fix(gatsby-image): add required check for one of fluid or fixed (gatsbyjs#25371) * Do not crash the page if the image component is invoked without parameters * added a warning if missing fluid and fixed props * had swapped a condition * doing destructuring in function parameter list * now with functioning tree-shaking * updating function doc: returns undefined, not null * switching to proptypes for validation * Update packages/gatsby-image/src/index.js Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Ward Peeters <[email protected]> * fix(gatsby): Load resources in ProdPageRenderer (gatsbyjs#26092) * Load resources in ProdPageRenderer * Add simple unit tests * chore(release): Publish - [email protected] - [email protected] - [email protected] * Update gatsby in www * Add plugincreator to API (gatsbyjs#26101) * Add plugincreator to API * fix capitlization Co-authored-by: Laurie Barth <[email protected]> * chore(showcase): Add Devnet (gatsbyjs#25952) Co-authored-by: Obinna Ekwuno <[email protected]> * Add pluagin source for page (gatsbyjs#26104) Co-authored-by: Laurie Barth <[email protected]> * fix(gatsby-source-contentful): support height parameter for srcset (gatsbyjs#25776) * Calculate fixed image width if necessary * Calculate fixed image width if necessary * Revert snapshot test changes * Bring back new test * Update snapshot * chore(docs): Add author Colby Fayock (gatsbyjs#26109) * adding Colby Fayock author avatar and bio * Update author.yaml adding new line at end of file * pretier * Use commonmark option to better handle list parsing * revert fixpack changes to root package.json * Squashed commit of the following: commit 33aff39 Author: Kyle Mathews <[email protected]> Date: Thu Jul 30 13:09:59 2020 -0700 Update index.md * Actually fix lint error * Fix test * more fixing tests * Only log when DEBUG=true * Remove --quiet to see errors * Add rollup * resolve conflicts * remove testing code * Make yarn.lock file valid * WORK PLEASE * Add yoga-layout-prebuilt as explicit dependency to make rollup + yarn 2.0 happy * Add node-fetch as dependency * Update packages/gatsby-recipes/src/graphql-server/server.js Co-authored-by: Peter van der Zee <[email protected]> * Use string matching for NPMPackage versions * Add missing string matcher * Fix lint error * Add missing normalize.css dep Co-authored-by: John Otander <[email protected]> Co-authored-by: Marcy Sutton <[email protected]> Co-authored-by: shannonbux <[email protected]> Co-authored-by: Paul Scanlon <[email protected]> Co-authored-by: Jarmo Isotalo <[email protected]> Co-authored-by: Blaine Kasten <[email protected]> Co-authored-by: Johnny Zabala <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: Aisha Blake <[email protected]> Co-authored-by: Michael Murphy <[email protected]> Co-authored-by: Dawood Sadiq <[email protected]> Co-authored-by: James Brooks <[email protected]> Co-authored-by: Haseeb Khan <[email protected]> Co-authored-by: Ankit Ghosh <[email protected]> Co-authored-by: Thijs <[email protected]> Co-authored-by: Thijs van Diessen <[email protected]> Co-authored-by: Muescha <[email protected]> Co-authored-by: Jordan Stapinski <[email protected]> Co-authored-by: Max Stoiber <[email protected]> Co-authored-by: Brennan Kinney <[email protected]> Co-authored-by: Nabeel Valley <[email protected]> Co-authored-by: Ward Peeters <[email protected]> Co-authored-by: Vatsal Mistry <[email protected]> Co-authored-by: Jack <[email protected]> Co-authored-by: Kurt Tomlinson <[email protected]> Co-authored-by: Lennart <[email protected]> Co-authored-by: Matt Kane <[email protected]> Co-authored-by: gatsbybot <[email protected]> Co-authored-by: Benedikt Rötsch <[email protected]> Co-authored-by: Joel Smith <[email protected]> Co-authored-by: Brent Jackson <[email protected]> Co-authored-by: Vladimir Razuvaev <[email protected]> Co-authored-by: Alex Moon <[email protected]> Co-authored-by: Yogi <[email protected]> Co-authored-by: Nat Alison <[email protected]> Co-authored-by: Laci-Texter <[email protected]> Co-authored-by: Tyler Barnes <[email protected]> Co-authored-by: LB <[email protected]> Co-authored-by: Hashim Warren <[email protected]> Co-authored-by: anubhavmeet <[email protected]> Co-authored-by: Dan Kirkham <[email protected]> Co-authored-by: Sidhartha Chatterjee <[email protected]> Co-authored-by: John Kavanagh <[email protected]> Co-authored-by: Julius <[email protected]> Co-authored-by: Julien Karst <[email protected]> Co-authored-by: Obinna Ekwuno <[email protected]> Co-authored-by: Tobias Meixner <[email protected]> Co-authored-by: Andy Stanberry <[email protected]> Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Andreas Ehrencrona <[email protected]> Co-authored-by: Laurie Barth <[email protected]> Co-authored-by: Marin Matošević <[email protected]> Co-authored-by: Sean Baines <[email protected]> Co-authored-by: Colby Fayock <[email protected]> Co-authored-by: Peter van der Zee <[email protected]>
Description
Scroll handling and restoration within Gatsby is diverged from browser basics. There are a few basic things I've found while researching that Gatsby does not do the same (and this PR fixes)
<h1 id="áccentuated">Scroll Here</h1>
While exploring this I also decided to clean up our code a bunch and remove some dependencies. Our usage of ScrollBehavior did not seem necessary. Maybe this is a foot gun and there were good reasons for it to exist.
I also added a
useScrollRestoration
hook that mirrors what Remix was selling for their scroll restoration inside of overflow containers.I was also able to convert this all to TS.
Documentation
Maybe documentation to add here?
Related Issues
Fixes:
shouldUpdateScroll componentDidMount - #23792 (fixed) (breaking?)
accentuated doclinks - #23690 (fixed)
POP does not restore scrollPosition - #8019 (fixed)
doclinks not scrolled to on load - #21120 (fixed)
Additional Discussion
I think it would be worth considering, and exploring removing the
shouldUpdateScroll
API from gatsby-browser. In my research, it was only used in user land to patch our bugs.