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 loading of preset title panel callback #3496

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

haslinghuis
Copy link
Member

Fixes:

PresetTitlePanel.js:128 Uncaught TypeError: this._onLoadedCallback is not a function
    at PresetTitlePanel._setupHtml (PresetTitlePanel.js:128:31)
    at HTMLDivElement.<anonymous> (PresetTitlePanel.js:58:100)
    at HTMLDivElement.<anonymous> (jquery.min.js:2:85383)
    at Function.each (jquery.min.js:2:3003)
    at S.fn.init.each (jquery.min.js:2:1481)
    at Object.<anonymous> (jquery.min.js:2:85365)
    at c (jquery.min.js:2:28327)
    at Object.fireWith [as resolveWith] (jquery.min.js:2:29072)
    at l (jquery.min.js:2:80045)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2:82499)

@Benky please have a look.

@haslinghuis haslinghuis added this to the 10.10.0 milestone Jun 25, 2023
@haslinghuis haslinghuis self-assigned this Jun 25, 2023
@github-actions

This comment has been minimized.

@blckmn
Copy link
Member

blckmn commented Jun 25, 2023

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> PASS
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> FAIL
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL

@limonspb
Copy link
Member

How to reproduce the bug before PR?

@haslinghuis
Copy link
Member Author

Just enter the presets tab and look at console.

@@ -125,7 +125,10 @@ export default class PresetTitlePanel

i18n.localizePage();
this._domWrapperDiv.toggle(true);
this._onLoadedCallback?.();

if (this._onLoadedCallback === typeof Function) {
Copy link
Member

@chmelevskij chmelevskij Jun 27, 2023

Choose a reason for hiding this comment

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

Feels that there is extra indirection in this logic. Something like the following is a bit simplified.

Suggested change
if (this._onLoadedCallback === typeof Function) {
if (typeof this._onLoadedCallback === 'function') {

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 👍

@sonarcloud
Copy link

sonarcloud bot commented Jun 27, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

Do you want to test this code? Here you have an automated build:
Betaflight-Configurator-Android
Betaflight-Configurator-Linux
Betaflight-Configurator-macOS
Betaflight-Configurator-Windows
WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

@haslinghuis haslinghuis merged commit c582fc2 into betaflight:master Jun 27, 2023
@haslinghuis haslinghuis deleted the fix-preset-title-panel branch June 27, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

5 participants