Merge pull request #17313 from desktop/releases/3.3.1

Release 3.3.1
This commit is contained in:
tidy-dev 2023-08-31 07:09:59 -04:00 committed by GitHub
commit cb7dc2df88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 99 deletions

View file

@ -3,7 +3,7 @@
"productName": "GitHub Desktop",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
"version": "3.3.0",
"version": "3.3.1",
"main": "./main.js",
"repository": {
"type": "git",

View file

@ -173,7 +173,6 @@ interface IFilterListState<T extends IFilterListItem> {
readonly rows: ReadonlyArray<IFilterListRow<T>>
readonly selectedRow: number
readonly filterValue: string
readonly filterValueChanged: boolean
}
/**
@ -194,33 +193,25 @@ export class FilterList<T extends IFilterListItem> extends React.Component<
IFilterListProps<T>,
IFilterListState<T>
> {
public static getDerivedStateFromProps(
props: IFilterListProps<IFilterListItem>,
state: IFilterListState<IFilterListItem>
) {
return createStateUpdate(props, state)
}
private list: List | null = null
private filterTextBox: TextBox | null = null
public constructor(props: IFilterListProps<T>) {
super(props)
if (props.filterTextBox !== undefined) {
this.filterTextBox = props.filterTextBox
}
this.state = createStateUpdate(props)
}
const filterValue = (props.filterText || '').toLowerCase()
this.state = {
rows: new Array<IFilterListRow<T>>(),
selectedRow: -1,
filterValue,
filterValueChanged: filterValue.length > 0,
public componentWillMount() {
if (this.props.filterTextBox !== undefined) {
this.filterTextBox = this.props.filterTextBox
}
}
public componentWillReceiveProps(nextProps: IFilterListProps<T>) {
this.setState(createStateUpdate(nextProps))
}
public componentDidUpdate(
prevProps: IFilterListProps<T>,
prevState: IFilterListState<T>
@ -285,23 +276,6 @@ export class FilterList<T extends IFilterListItem> extends React.Component<
)
}
public renderLiveContainer() {
if (!this.state.filterValueChanged) {
return null
}
const itemRows = this.state.rows.filter(row => row.kind === 'item')
const resultsPluralized = itemRows.length === 1 ? 'result' : 'results'
const screenReaderMessage = `${itemRows.length} ${resultsPluralized}`
return (
<AriaLiveContainer
message={screenReaderMessage}
trackedUserInput={this.state.filterValue}
/>
)
}
public renderFilterRow() {
if (this.props.hideFilterRow === true) {
return null
@ -316,10 +290,16 @@ export class FilterList<T extends IFilterListItem> extends React.Component<
}
public render() {
const itemRows = this.state.rows.filter(row => row.kind === 'item')
const resultsPluralized = itemRows.length === 1 ? 'result' : 'results'
const screenReaderMessage = `${itemRows.length} ${resultsPluralized}`
return (
<div className={classnames('filter-list', this.props.className)}>
{this.renderLiveContainer()}
<AriaLiveContainer
message={screenReaderMessage}
trackedUserInput={this.state.filterValue}
/>
{this.props.renderPreList ? this.props.renderPreList() : null}
{this.renderFilterRow()}
@ -597,8 +577,7 @@ export function getText<T extends IFilterListItem>(
}
function createStateUpdate<T extends IFilterListItem>(
props: IFilterListProps<T>,
state: IFilterListState<T>
props: IFilterListProps<T>
) {
const flattenedRows = new Array<IFilterListRow<T>>()
const filter = (props.filterText || '').toLowerCase()
@ -639,15 +618,7 @@ function createStateUpdate<T extends IFilterListItem>(
selectedRow = flattenedRows.findIndex(i => i.kind === 'item')
}
// Stay true if already set, otherwise become true if the filter has content
const filterValueChanged = state.filterValueChanged ? true : filter.length > 0
return {
rows: flattenedRows,
selectedRow,
filterValue: filter,
filterValueChanged,
}
return { rows: flattenedRows, selectedRow, filterValue: filter }
}
function getItemFromRowIndex<T extends IFilterListItem>(

View file

@ -166,7 +166,6 @@ interface IFilterListState<T extends IFilterListItem> {
readonly rows: ReadonlyArray<ReadonlyArray<IFilterListRow<T>>>
readonly selectedRow: RowIndexPath
readonly filterValue: string
readonly filterValueChanged: boolean
// Indices of groups in the filtered list
readonly groups: ReadonlyArray<number>
}
@ -175,34 +174,25 @@ interface IFilterListState<T extends IFilterListItem> {
export class SectionFilterList<
T extends IFilterListItem
> extends React.Component<ISectionFilterListProps<T>, IFilterListState<T>> {
public static getDerivedStateFromProps(
props: ISectionFilterListProps<IFilterListItem>,
state: IFilterListState<IFilterListItem>
) {
return createStateUpdate(props, state)
}
private list: SectionList | null = null
private filterTextBox: TextBox | null = null
public constructor(props: ISectionFilterListProps<T>) {
super(props)
if (props.filterTextBox !== undefined) {
this.filterTextBox = props.filterTextBox
}
this.state = createStateUpdate(props)
}
const filterValue = (props.filterText || '').toLowerCase()
this.state = {
rows: new Array<Array<IFilterListRow<T>>>(),
selectedRow: InvalidRowIndexPath,
filterValue,
filterValueChanged: filterValue.length > 0,
groups: [],
public componentWillMount() {
if (this.props.filterTextBox !== undefined) {
this.filterTextBox = this.props.filterTextBox
}
}
public componentWillReceiveProps(nextProps: ISectionFilterListProps<T>) {
this.setState(createStateUpdate(nextProps))
}
public componentDidUpdate(
prevProps: ISectionFilterListProps<T>,
prevState: IFilterListState<T>
@ -267,23 +257,6 @@ export class SectionFilterList<
)
}
public renderLiveContainer() {
if (!this.state.filterValueChanged) {
return null
}
const itemRows = this.state.rows.flat().filter(row => row.kind === 'item')
const resultsPluralized = itemRows.length === 1 ? 'result' : 'results'
const screenReaderMessage = `${itemRows.length} ${resultsPluralized}`
return (
<AriaLiveContainer
trackedUserInput={this.state.filterValue}
message={screenReaderMessage}
/>
)
}
public renderFilterRow() {
if (this.props.hideFilterRow === true) {
return null
@ -298,10 +271,16 @@ export class SectionFilterList<
}
public render() {
const itemRows = this.state.rows.flat().filter(row => row.kind === 'item')
const resultsPluralized = itemRows.length === 1 ? 'result' : 'results'
const screenReaderMessage = `${itemRows.length} ${resultsPluralized}`
return (
<div className={classnames('filter-list', this.props.className)}>
{this.renderLiveContainer()}
<AriaLiveContainer
trackedUserInput={this.state.filterValue}
message={screenReaderMessage}
/>
{this.props.renderPreList ? this.props.renderPreList() : null}
{this.renderFilterRow()}
@ -635,8 +614,7 @@ function getFirstVisibleRow<T extends IFilterListItem>(
}
function createStateUpdate<T extends IFilterListItem>(
props: ISectionFilterListProps<T>,
state: IFilterListState<T>
props: ISectionFilterListProps<T>
) {
const rows = new Array<Array<IFilterListRow<T>>>()
const filter = (props.filterText || '').toLowerCase()
@ -686,16 +664,7 @@ function createStateUpdate<T extends IFilterListItem>(
selectedRow = getFirstVisibleRow(rows)
}
// Stay true if already set, otherwise become true if the filter has content
const filterValueChanged = state.filterValueChanged ? true : filter.length > 0
return {
rows: rows,
selectedRow,
filterValue: filter,
filterValueChanged,
groups: groupIndices,
}
return { rows: rows, selectedRow, filterValue: filter, groups: groupIndices }
}
function getItemFromRowIndex<T extends IFilterListItem>(

View file

@ -1,5 +1,9 @@
{
"releases": {
"3.3.1": [
"[Fixed] Support the repository rule to enforce commit signing - #17310",
"[Fixed] Keyboard navigation in lists reintroduced - #17313"
],
"3.3.0": [
"[New] Initial support for repository rules - #16707",
"[Fixed] Recreate stash after renaming branch - #16442",