You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "msyavuz (via GitHub)" <gi...@apache.org> on 2026/04/17 15:58:50 UTC
[PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
msyavuz opened a new pull request, #39442:
URL: https://github.com/apache/superset/pull/39442
Handlebars controls use camelCase names (`handlebarsTemplate`, `styleTemplate`) while Superset's form_data convention is snake_case. Charts created via the MCP service store params with the snake_case key `handlebars_template`, so on explore hydration the control framework's `formData[name]` lookup misses and the control falls back to its default template — silently overwriting the saved custom template on the next save. The existing `mapStateToProps` also read from the wrong key (controls[snake] instead of the camelCase control state), so it couldn't rescue the value.
Fix by reading the value from `form_data` with both casings as fallbacks, keeping old and new charts compatible without requiring a migration.
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
<!--- Required! What steps can be taken to manually verify the changes? -->
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4269504035
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4270036749
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4304976812
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/24838206131) for [98bd380](https://github.com/apache/superset/commit/98bd380)
• **Environment:** http://35.85.54.43:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "msyavuz (via GitHub)" <gi...@apache.org>.
msyavuz merged PR #39442:
URL: https://github.com/apache/superset/pull/39442
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4280590715
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/24665841586) for [98bd380](https://github.com/apache/superset/commit/98bd380)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4269599639
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/39442?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.54%. Comparing base ([`7c76fd3`](https://app.codecov.io/gh/apache/superset/commit/7c76fd3d81a70af14e2a1991141562e9be6464f3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`b282feb`](https://app.codecov.io/gh/apache/superset/commit/b282feba8943fed1f14853332d06063250644071?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 12 commits behind head on master.
:x: Your project check has failed because the head coverage (99.79%) is below the target coverage (100.00%). You can increase the head coverage or adjust the [target](https://docs.codecov.com/docs/commit-status#target) coverage.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #39442 +/- ##
=======================================
Coverage 64.54% 64.54%
=======================================
Files 2557 2557
Lines 132985 132987 +2
Branches 30890 30892 +2
=======================================
+ Hits 85829 85834 +5
+ Misses 45666 45663 -3
Partials 1490 1490
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/39442/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/39442/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.33% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/39442?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #39442:
URL: https://github.com/apache/superset/pull/39442#discussion_r3101655102
##########
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx:
##########
@@ -106,8 +106,8 @@ export const handlebarsTemplateControlSetItem: ControlSetItem = {
valueKey: null,
validators: [validateNonEmpty],
- mapStateToProps: ({ controls }) => ({
- value: controls?.handlebars_template?.value,
+ mapStateToProps: ({ form_data }) => ({
+ value: form_data?.handlebars_template ?? form_data?.handlebarsTemplate,
Review Comment:
**Suggestion:** The fallback order is reversed: preferring `handlebars_template` over `handlebarsTemplate` can resurrect stale data when both keys exist (which happens after editing in Explore, since control updates add camelCase while existing snake_case remains in `form_data`). This causes users' latest saved template to be overwritten by the old value on subsequent opens. Prefer camelCase first and only fall back to snake_case for legacy charts. [logic error]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Explore opens handlebars charts with stale template content.
- ⚠️ User edits to handlebars template silently discarded on reopen.
- ⚠️ MCP-created handlebars charts unreliable when editing templates.
```
</details>
```suggestion
value: form_data?.handlebarsTemplate ?? form_data?.handlebars_template,
```
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Create or load a Handlebars chart whose saved `form_data` in the backend contains
`handlebars_template` with some initial template text (legacy snake_case key, as described
in the PR summary).
2. Open this chart in Explore; the frontend initializes the control panel for the
Handlebars viz type, which includes `handlebarsTemplateControlSetItem` defined at
`superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx:92-112`.
3. In Explore, edit the Handlebars template in the UI and save the chart; the control
framework writes the updated value to `form_data.handlebarsTemplate` (camelCase) while the
original `form_data.handlebars_template` (snake_case) remains unchanged with the older
content.
4. Reopen the same chart in Explore; `mapStateToProps` at line 110 reads `value:
form_data?.handlebars_template ?? form_data?.handlebarsTemplate`, so it resolves to the
stale `handlebars_template` value even though `handlebarsTemplate` holds the newer
user-edited template, causing the old template to be shown and then re-saved on the next
save.
```
</details>
[Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fplugins%2Fplugin-chart-handlebars%2Fsrc%2Fplugin%2Fcontrols%2FhandlebarTemplate.tsx%0A%2A%2ALine%3A%2A%2A%20110%3A110%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20fallback%20order%20is%20reversed%3A%20preferring%20%60handlebars_template%60%20over%20%60handlebarsTemplate%60%20can%20resurrect%20stale%20data%20when%20both%20keys%20exist%20%28which%20happens%20after%20editing%20in%20Explore%2C%20since%20control%20updates%20add%20camelCase%20while%20existing%20snake_case%20remains%20in%20%60form_data%60%29.%20This%20causes%20users%27%20latest%20saved%20template%20to%20be%20overwritten%20by%20the%20old%20value%20on%20subsequent%20opens.%20Prefer%20camelCase%20first%20and%20only%20fall%20back%20to%20snake_case%20for%20legacy%20charts.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20I
f%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset-frontend%2Fplugins%2Fplugin-chart-handlebars%2Fsrc%2Fplugin%2Fcontrols%2FhandlebarTemplate.tsx%0A%2A%2ALine%3A%2A%2A%20110%3A110%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20fallback%20order%20is%20reversed%3A%20preferring%20%60handlebars_template%60%20over%20%60handlebarsTemplate%60%20can%20resurrect%20stale%20data%20when%20both%20keys%20exist%20%28which%20happens%20after%20editing%20in%20Explore%2C%20since%20control%20updates%20add%20camelCase%20while%20existing%20snake_case%20remains%20in%20%60form_data%60%29.%20This%20causes%20users%27%20latest%20saved%20template%20to%20be%20overwritten%20by%20the%20old%20value%20on%20subsequent%20opens.%20Prefer
%20camelCase%20first%20and%20only%20fall%20back%20to%20snake_case%20for%20legacy%20charts.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0A)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx
**Line:** 110:110
**Comment:**
*Logic Error: The fallback order is reversed: preferring `handlebars_template` over `handlebarsTemplate` can resurrect stale data when both keys exist (which happens after editing in Explore, since control updates add camelCase while existing snake_case remains in `form_data`). This causes users' latest saved template to be overwritten by the old value on subsequent opens. Prefer camelCase first and only fall back to snake_case for legacy charts.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39442&comment_hash=d2a60ef9dc3f6116e83528da135c06b71734262d1d9009d1a006bd368edfcab1&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F39442&comment_hash=d2a60ef9dc3f6116e83528da135c06b71734262d1d9009d1a006bd368edfcab1&reaction=dislike'>👎</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4280743099
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) deployed environment on [GHA](https://github.com/apache/superset/actions/runs/24665841586) for [98bd380](https://github.com/apache/superset/commit/98bd380)
• **Environment:** http://35.94.146.149:8080 (admin/admin)
• **Lifetime:** 48h auto-cleanup
• **Updates:** New commits create fresh environments automatically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4304807819
🎪 [Showtime](https://github.com/mistercrunch/superset-showtime) is building environment on [GHA](https://github.com/apache/superset/actions/runs/24838206131) for [98bd380](https://github.com/apache/superset/commit/98bd380)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4269535736
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | b282feba8943fed1f14853332d06063250644071 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69e258bb1d93ca00082a4d17 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-39442--superset-docs-preview.netlify.app](https://deploy-preview-39442--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-39442--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(plugin-chart-handlebars): preserve template on explore open [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #39442:
URL: https://github.com/apache/superset/pull/39442#issuecomment-4333809556
**Bito Automatic Review Skipped – PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org