hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

[Bug]: Named expression defined as a cell range does not recalculate

Open Esmail-Rahmani opened this issue 9 months ago • 7 comments

Description

When using named expressions in HyperFormula, formulas update correctly if a value is initially set in a referenced cell. However, if we update a cell that already has a value, the formula does not recalculate automatically.

The issue is only resolved when we manually call hfInstance.rebuildAndRecalculate(), which pauses our application and significantly slows down performance in our large-scale application.

Steps to Reproduce: Open this Demo Link Click Run Logic to see initial calculations working. Observe that updating a cell does not trigger recalculation. Manually call rebuildAndRecalculate() → The formula updates, but at the cost of app performance.

Expected Behavior: ✅ Named expressions should always recalculate when referenced cells are updated. ✅ No need for rebuildAndRecalculate() for normal updates.

Actual Behavior: ❌ Updating a cell that already has a value does not trigger recalculation. ❌ rebuildAndRecalculate() is required but causes performance issues in large applications.

Impact on Our Application: 🚨 Our app is large, and calling rebuildAndRecalculate() frequently slows it down and freezes the UI. We need a more efficient solution that ensures named expressions update automatically when cell values change.

Video or screenshots

No response

Demo

https://stackblitz.com/edit/druuakr9?file=index.ts

HyperFormula version

HyperFormula 3.0.0

Your framework

Vue 3

Your environment

Chrome 133 on macOS 15.3.1

Esmail-Rahmani avatar Mar 06 '25 08:03 Esmail-Rahmani

Hi @Esmail-Rahmani, thank you for reaching out.

I can confirm it is a bug. I'm adding it to our backlog.

sequba avatar Mar 08 '25 10:03 sequba

Hi! Just following up on this bug.

kenken182 avatar Apr 16 '25 18:04 kenken182

Hi @kenken182

This issue is not yet scheduled to be fixed. We will make sure to update you as soon as it changes.

AMBudnik avatar Apr 17 '25 06:04 AMBudnik

@sequba Could you please review this PR? We encountered a significant performance bottleneck in our application due to this bug.

AbdulQaharRahmani avatar Apr 26 '25 10:04 AbdulQaharRahmani

Hi @AbdulQaharRahmani I informed the team about the pull request. We should be able to review it in the next sprint session.

AMBudnik avatar Apr 28 '25 12:04 AMBudnik

Hi @AMBudnik , I hope you're doing well! I am following up regarding the pull request we discussed earlier (fixing named expressions performance). Has there been any update or progress on the review? We're still experiencing some issues on our side and would greatly appreciate any feedback or timeline.

Thanks again!

Esmail-Rahmani avatar May 25 '25 07:05 Esmail-Rahmani

Hi @Esmail-Rahmani

I can see that my colleague is already assigned to review this pull request.

Now he's finishing other tasks but should move to the review soon.

AMBudnik avatar May 26 '25 05:05 AMBudnik

Hi @Esmail-Rahmani

I am happy to share the good news. We just launched HyperFormula v3.0.1, where this issue is fixed.

Thank you for the contribution!

Here https://hyperformula.handsontable.com/guide/release-notes.html, you can read more about the changes in this version.

CC @kenken182 @AbdulQaharRahmani

AMBudnik avatar Aug 11 '25 09:08 AMBudnik