Skip to content
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

Remove deprecated APIs #1453

Merged
merged 5 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Changed

- **Breaking change**: Removed the `binarySearchThreshold` configuration option. [#1439](https://github.com/handsontable/hyperformula/issues/1439)

## [2.7.1] - 2024-07-18

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions docs/guide/migration-from-2.x-to-3.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Migrating from 2.x to 3.0

To upgrade your HyperFormula version from 2.x.x to 3.0.0, follow this guide.

## Removal of the `binarySearchThreshold` configuration option (deprecated since version 1.1.0)

The `binarySearchThreshold` has no effect since version 1.1.0. If your codebase still uses this option, please remove it.
3 changes: 0 additions & 3 deletions docs/guide/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ not be used despite the option `useColumnIndex` enabled when using

Leaving this option disabled will cause the engine to use binary
search when dealing with sorted data, and the naive approach otherwise.
However, binary search will not be used if the size of the data being
searched is below a given threshold, which can be customized using the
`binarySearchThreshold` option in the configuration.

## Address mapping strategies

Expand Down
8 changes: 2 additions & 6 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class Config implements ConfigParams, ParserConfig {

public static defaultConfig: ConfigParams = {
accentSensitive: false,
binarySearchThreshold: 20,
currencySymbol: ['$'],
caseSensitive: false,
caseFirst: 'lower',
Expand Down Expand Up @@ -130,8 +129,6 @@ export class Config implements ConfigParams, ParserConfig {
/** @inheritDoc */
public readonly useStats: boolean
/** @inheritDoc */
public readonly binarySearchThreshold: number
/** @inheritDoc */
public readonly nullDate: SimpleDate
/** @inheritDoc */
public readonly currencySymbol: string[]
Expand Down Expand Up @@ -167,7 +164,6 @@ export class Config implements ConfigParams, ParserConfig {
constructor(options: Partial<ConfigParams> = {}, showDeprecatedWarns: boolean = true) {
const {
accentSensitive,
binarySearchThreshold,
caseSensitive,
caseFirst,
chooseAddressMappingPolicy,
Expand Down Expand Up @@ -240,7 +236,6 @@ export class Config implements ConfigParams, ParserConfig {
validateNumberToBeAtLeast(this.precisionEpsilon, 'precisionEpsilon', 0)
this.useColumnIndex = configValueFromParam(useColumnIndex, 'boolean', 'useColumnIndex')
this.useStats = configValueFromParam(useStats, 'boolean', 'useStats')
this.binarySearchThreshold = binarySearchThreshold ?? Config.defaultConfig.binarySearchThreshold
this.parseDateTime = configValueFromParam(parseDateTime, 'function', 'parseDateTime')
this.stringifyDateTime = configValueFromParam(stringifyDateTime, 'function', 'stringifyDateTime')
this.stringifyDuration = configValueFromParam(stringifyDuration, 'function', 'stringifyDuration')
Expand Down Expand Up @@ -315,7 +310,8 @@ export class Config implements ConfigParams, ParserConfig {
}

private static warnDeprecatedOptions(options: Partial<ConfigParams>) {
Config.warnDeprecatedIfUsed(options.binarySearchThreshold, 'binarySearchThreshold', '1.1')
// an example of deprecation warning
// Config.warnDeprecatedIfUsed(options.binarySearchThreshold, 'binarySearchThreshold', '1.1')
sequba marked this conversation as resolved.
Show resolved Hide resolved
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
7 changes: 0 additions & 7 deletions src/ConfigParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ export interface ConfigParams {
* @category String
*/
accentSensitive: boolean,
/**
* Sets a minimum number of elements that a range must have to use binary search.
* @deprecated Every search of sorted data always uses binary search.
* @default 20
* @category Engine
*/
binarySearchThreshold: number,
/**
* When set to `true`, makes string comparison case-sensitive.
*
Expand Down
4 changes: 0 additions & 4 deletions src/DependencyGraph/ValueCellVertex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ export class ValueCellVertex {
public getCellValue(): ValueCellVertexValue {
return this.parsedValue
}

public setCellValue(_cellValue: ValueCellVertexValue): never {
throw Error('SetCellValue is deprecated for ValueCellVertex')
}
}
31 changes: 0 additions & 31 deletions test/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,37 +402,6 @@ describe('Config', () => {
afterEach(() => {
resetSpy(console.warn)
})

it('should log usage of deprecated options when they are passed while engine initialization', () => {
new Config({
binarySearchThreshold: 20,
})

expect(console.warn).toHaveBeenCalledWith('binarySearchThreshold option is deprecated since 1.1')
expect(console.warn).toHaveBeenCalledTimes(1)
})

it('should log usage of deprecated options when they are passed while merging the Config object', () => {
const config = new Config()

config.mergeConfig({
binarySearchThreshold: 20
})

expect(console.warn).toHaveBeenCalledTimes(1)
expect(console.warn).toHaveBeenCalledWith('binarySearchThreshold option is deprecated since 1.1')
})

it('should not log usage of deprecated options when they are not passed while merging the Config object', () => {
const config = new Config({
binarySearchThreshold: 20,
})
resetSpy(console.warn)

config.mergeConfig({})

expect(console.warn).not.toHaveBeenCalled()
})
})
})

Expand Down
4 changes: 0 additions & 4 deletions test/cruds/change-cell-content.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,12 @@ describe('changing cell content', () => {
['1', '2', '=SUM(A1:B1)'],
]
const engine = HyperFormula.buildFromArray(sheet)
const b1 = engine.addressMapping.getCell(adr('B1'))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const b1setCellValueSpy = spyOn(b1 as any, 'setCellValue')
const c1 = engine.addressMapping.getCell(adr('C1'))
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const c1setCellValueSpy = spyOn(c1 as any, 'setCellValue')

engine.setCellContents(adr('B1'), [['2']])

expect(b1setCellValueSpy).not.toHaveBeenCalled()
expect(c1setCellValueSpy).not.toHaveBeenCalled()
})

Expand Down
Loading