Skip to content

Conversation

@Steve-Mcl
Copy link
Collaborator

The new option to disable mustache parsing did not work due to an incorrect falsy check.

This PR does:

  • Ensure setting for parseMustache is respected
  • Skips mustache rendering if no tokens exist in the the query (auto skip mustache rendering)
  • A little code tidy and linting

@Steve-Mcl Steve-Mcl requested a review from Copilot May 15, 2025 18:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the issue with the mustache parsing option not being respected, and improves code readability and linting in the related modules.

  • Updates the falsy check for the parseMustache configuration to correctly disable mustache parsing.
  • Introduces a token extraction check to skip rendering when no mustache tokens are found.
  • Refactors code in the HTML editor to use a clearer undefined check.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/mssql.js Corrects parseMustache logic and refactors token extraction control flow.
src/mssql.html Improves the undefined check for parseMustache in the editor.

@Steve-Mcl Steve-Mcl requested a review from Copilot May 15, 2025 18:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the issue preventing the disabling of mustache parsing by correcting the falsy check while also tidying up the code.

  • Fixed falsy check for the mustache parsing configuration.
  • Added an auto-skip for mustache rendering if no tokens are found.
  • Improved code tidiness and linting.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/mssql.js Updated falsy check for mustache parsing and token handling.
src/mssql.html Revised undefined check for parseMustache in the editor UI.
Comments suppressed due to low confidence (2)

src/mssql.js:499

  • [nitpick] The corrected falsy check for config.parseMustache now properly respects explicit false values. Verify that other falsy inputs (e.g., null or 0) are intended to enable mustache parsing.
node.parseMustache = !(config.parseMustache === false || config.parseMustache === 'false'); // if not explicitly set to false, then enable mustache parsing

src/mssql.html:420

  • [nitpick] Using 'typeof' to safely check for undefined enhances robustness over direct undefined comparisons.
if (typeof node.parseMustache === 'undefined') {

@Steve-Mcl
Copy link
Collaborator Author

Steve-Mcl commented May 15, 2025

@bestlong please review & merge ASAP
Also please push a new patch release 0.12.3

@Steve-Mcl Steve-Mcl requested a review from bestlong May 15, 2025 18:11
@Steve-Mcl Steve-Mcl changed the title Fix no mustache Fix ineffective parseMustache option May 15, 2025
@bestlong bestlong merged commit 124c5fd into master May 16, 2025
0 of 4 checks passed
@Steve-Mcl Steve-Mcl deleted the fix-no-mustache branch May 16, 2025 07:51
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.

3 participants