Skip to content

Commit

Permalink
chore: lint & set node version in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
demshy committed Jul 25, 2023
1 parent d019e2c commit 763bb67
Show file tree
Hide file tree
Showing 5 changed files with 3,271 additions and 3,477 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
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '*'
node-version: 18
check-latest: true
if: ${{ needs.changes.outputs.cms == 'true' }}
- name: log versions
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '*'
node-version: 18
check-latest: true
cache: yarn
if: ${{ needs.changes.outputs.cms == 'true' }}
Expand Down
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 763bb67

Please sign in to comment.