Skip to content

Commit

Permalink
chore: some more lint suff
Browse files Browse the repository at this point in the history
  • Loading branch information
demshy committed Jul 24, 2023
1 parent d019e2c commit feadf1e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
},
],
'unicorn/prefer-string-slice': 'error',
'react/no-unknown-property': ['error', { ignore: ['css', 'bold', 'italic', 'delete'] }],
},
plugins: ['babel', '@emotion', 'cypress', 'unicorn'],
settings: {
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: .yarn/releases/yarn-1.19.0.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class MediaLibrary extends React.Component {
state = {
selectedFile: {},
query: '',
isPersisted: false,
};

componentDidMount() {
Expand All @@ -89,6 +90,13 @@ class MediaLibrary extends React.Component {
if (isOpening) {
this.setState({ selectedFile: {}, query: '' });
}

if (this.state.isPersisted) {
this.setState({
selectedFile: nextProps.files[0],
isPersisted: false,
});
}
}

componentDidUpdate(prevProps) {
Expand All @@ -97,6 +105,13 @@ class MediaLibrary extends React.Component {
if (isOpening && prevProps.privateUpload !== this.props.privateUpload) {
this.props.loadMedia({ privateUpload: this.props.privateUpload });
}

if (this.state.isPersisted) {
this.setState({
selectedFile: this.props.files[0],
isPersisted: false,
});
}
}

loadDisplayURL = file => {
Expand Down Expand Up @@ -186,7 +201,7 @@ class MediaLibrary extends React.Component {
} else {
await persistMedia(file, { privateUpload, field });

this.setState({ selectedFile: this.props.files[0] });
this.setState({ isPersisted: true });

this.scrollToTop();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/netlify-cms-core/src/formats/frontmatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const Languages = {
JSON: 'json',
} as const;

type Language = typeof Languages[keyof typeof Languages];
type Language = (typeof Languages)[keyof typeof Languages];

export type Delimiter = string | [string, string];
type Format = { language: Language; delimiters: Delimiter };
Expand Down

0 comments on commit feadf1e

Please sign in to comment.