Skip to content

Commit

Permalink
[core] Fix scroll restoration (#34037)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 23, 2022
1 parent 99b23c0 commit 1c9b514
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.old.md
Original file line number Diff line number Diff line change
Expand Up @@ -13558,7 +13558,7 @@ _May 24, 2015_

### Breaking Changes

- Refactored all CSS into Javascript (#30, #316)
- Refactored all CSS into JavaScript (#30, #316)
- All Material UI components now have their styles defined inline. This solves
many problems with CSS as mentions in [@vjeux's presentation](https://speakerdeck.com/vjeux/react-css-in-js)
such as polluting the global namespace with classes that really should be
Expand Down
19 changes: 13 additions & 6 deletions docs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,25 @@ if (staging) {
console.log(`Staging deploy of ${process.env.REPOSITORY_URL || 'local repository'}`);
}

module.exports = {
const baseline = {
experimental: {
scrollRestoration: true,
},
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
// Motivated by https://github.com/vercel/next.js/issues/7687
ignoreBuildErrors: true,
},
trailingSlash: true,
// Can be turned on when https://github.com/vercel/next.js/issues/24640 is fixed
optimizeFonts: false,
};

module.exports = {
...baseline,
baseline, // Exported so the other projects can use this configuration directly.
webpack: (config, options) => {
const plugins = config.plugins.slice();

Expand Down Expand Up @@ -179,7 +190,6 @@ module.exports = {
NETLIFY_DEPLOY_URL: process.env.DEPLOY_URL || 'http://localhost:3000',
NETLIFY_SITE_NAME: process.env.SITE_NAME || 'material-ui',
PULL_REQUEST: process.env.PULL_REQUEST === 'true',
REACT_STRICT_MODE: reactStrictMode,
FEEDBACK_URL: process.env.FEEDBACK_URL,
// #default-branch-switch
SOURCE_CODE_ROOT_URL: 'https://github.com/mui/material-ui/blob/master',
Expand Down Expand Up @@ -238,16 +248,13 @@ module.exports = {
return map;
},
reactStrictMode,
trailingSlash: true,
// rewrites has no effect when run `next export` for production
async rewrites() {
rewrites: async () => {
return [
{ source: `/:lang(${LANGUAGES.join('|')})?/:rest*`, destination: '/:rest*' },
// Make sure to include the trailing slash if `trailingSlash` option is set
{ source: '/api/:rest*/', destination: '/api-docs/:rest*/' },
{ source: `/static/x/:rest*`, destination: 'http://0.0.0.0:3001/static/x/:rest*' },
];
},
// Can be turned on when https://github.com/vercel/next.js/issues/24640 is fixed
optimizeFonts: false,
};
2 changes: 1 addition & 1 deletion docs/pages/blog/2019-developer-survey-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ designers to give it a bespoke look and feel for their organization.

<img src="/static/blog/2019-survey/9.png" style="display: block; margin: 0 auto;" alt="Bar chart: 26 x I'm just getting started!, 43 x 6 months +, 150 x 1 year +, 179 x 3 years +, 155 x 5 years, 82 x 10 years +, 47 x 15 years +" />

A nice bell curve, with the majority of developers having 1 to 5 years experience with Javascript.
A nice bell curve, with the majority of developers having 1 to 5 years experience with JavaScript.

### 10. How long have you been developing with React?

Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/showcase/ThemeChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function ThemeChip() {
<ThemeProvider theme={theme}>
<Stack direction="row" spacing={2}>
<Chip label="React" color="primary" onDelete={() => {}} />
<Chip label="Javascript" onDelete={() => {}} />
<Chip label="JavaScript" onDelete={() => {}} />
</Stack>
</ThemeProvider>
);
Expand Down
13 changes: 1 addition & 12 deletions docs/src/modules/components/ThemeContext.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import {
ThemeProvider as MuiThemeProvider,
createTheme as createLegacyModeTheme,
unstable_createMuiStrictModeTheme as createStrictModeTheme,
} from '@mui/material/styles';
import { ThemeProvider as MuiThemeProvider, createTheme } from '@mui/material/styles';
import { deepmerge } from '@mui/utils';
import useMediaQuery from '@mui/material/useMediaQuery';
import { enUS, zhCN, faIR, ruRU, ptBR, esES, frFR, deDE, jaJP } from '@mui/material/locale';
Expand Down Expand Up @@ -116,13 +112,6 @@ if (process.env.NODE_ENV !== 'production') {
DispatchContext.displayName = 'ThemeDispatchContext';
}

let createTheme;
if (process.env.REACT_STRICT_MODE) {
createTheme = createStrictModeTheme;
} else {
createTheme = createLegacyModeTheme;
}

export function ThemeProvider(props) {
const { children } = props;
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
Expand Down

0 comments on commit 1c9b514

Please sign in to comment.