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

Fix duplicated messages about deprecated options usage #882

Merged
merged 6 commits into from Jan 10, 2022

Conversation

budnix
Copy link
Member

@budnix budnix commented Jan 3, 2022

Context

The PR fixes an issue related to the doubled or tripled printed deprecated warning messages.

After the changes once the Hyperformula is initialized the warn messages are logged only once. The messages are logged again only if the engine.updateConfig() method is called and only when the deprecated options are passed.

Do prints deprecated warn messages:

  • HyperFormula.buildEmpty({ binarySearchThreshold: 10 });
  • engine.updateConfig({ binarySearchThreshold: 10 })

Do not print deprecated warn messages:

  • engine.updateConfig({ precisionRounding: 10 })
  • engine.rebuildAndRecalculate()

I had a problem with tests in the browser. It turned out that there is a problem with unregistering Jasmine spies that interfere with other tests. To fix it up I upgraded the Jasmine to the latest version.

The PR solves the problem with Handsontable integration where its Formulas plugin calls the HF rebuildAndRecalculate method. The method internally merges the Config object with default values (e.g. binarySearchThreshold: 20) that once passed in the constructor logs again warning messages about the usage of deprecated options. See handsontable/handsontable#8771.

How has this been tested?

I tested the changes locally and I added some tests that cover the fix.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Related issue(s):

  1. Pu/configwarnings #830

Checklist:

  • My code follows the code style of this project,
  • My change requires a change to the documentation,
  • I described the modification in the CHANGELOG.md file.

@codecov
Copy link

codecov bot commented Jan 4, 2022

Codecov Report

Merging #882 (e22ff93) into develop (40b9578) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop     #882     +/-   ##
==========================================
  Coverage    92.14%   92.14%             
==========================================
  Files          167      167             
  Lines        40515    40530     +15     
  Branches      5594     3734   -1860     
==========================================
+ Hits         37332    37347     +15     
- Misses        3142     3177     +35     
+ Partials        41        6     -35     
Impacted Files Coverage Δ
src/Config.ts 98.69% <100.00%> (+0.02%) ⬆️
src/Cell.ts 95.13% <0.00%> (ø)
src/ArraySize.ts 63.85% <0.00%> (ø)
src/Operations.ts 92.47% <0.00%> (ø)
src/DateTimeHelper.ts 82.73% <0.00%> (ø)
src/DateTimeDefault.ts 56.36% <0.00%> (ø)
src/AbsoluteCellRange.ts 86.97% <0.00%> (ø)
src/Lookup/ColumnIndex.ts 81.21% <0.00%> (ø)
src/Lookup/AdvancedFind.ts 90.32% <0.00%> (ø)
src/parser/FormulaParser.ts 82.15% <0.00%> (ø)
... and 14 more

@budnix budnix marked this pull request as ready for review January 4, 2022 10:10
@budnix budnix self-assigned this Jan 4, 2022
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
this.binarySearchThreshold = undefined
this.binarySearchThreshold = binarySearchThreshold ?? Config.defaultConfig.binarySearchThreshold
Copy link
Member

@warpech warpech Jan 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I am terribly mistaken, this PR missed the most important point, that binarySearchThreshold is not used anywhere.

Therefore, it should be removed:

  • from members of this class
  • from the default config object
  • from docs/guide/performance.md

We can keep the warning if someone tries using it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a continuation of the original PR (#830) I tried to focus on fixing the double warnings and covering the change with tests only. To keep the PR as simple as possible with the possibility to release the patch version.

Removing the binarySearchThreshold option from defaults would generate a new TS definition. I don't know if that wouldn't be a breaking change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right that it would be an unnecessary breaking change. With your change, it is possible to release this as a PATCH version.

@budnix budnix merged commit c38de67 into develop Jan 10, 2022
@budnix budnix deleted the feature/remove-duplicated-warns branch January 10, 2022 08:59
@AMBudnik
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants