Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] taro-vchart misses function-only spec updates and throws on cyclic specs

Open
#4,656 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

Start with componentDidUpdate in packages/taro-vchart/src/components/general-chart/index.tsx and packages/taro-vchart/src/components/web-chart/index.tsx, then inspect how updateSpec is called. Add tests for function-only changes and cyclic specs, choosing and documenting the intended comparison semantics and update cost. Done means valid callback changes trigger updateSpec and cyclic input no longer throws.

Written by the indexing model from the issue text.

Description

Version

@visactor/taro-vchart on develop at 0750d74cd6ea734e66897876506c78ca12680676

Link to Minimal Reproduction

The update guards in both of these components reproduce the comparison behavior directly:

  • packages/taro-vchart/src/components/general-chart/index.tsx
  • packages/taro-vchart/src/components/web-chart/index.tsx

For example, JSON.stringify({ formatter: () => 'old' }) and JSON.stringify({ formatter: () => 'new' }) are both {}. A cyclic object throws from JSON.stringify.

Steps to Reproduce
  1. Render a Taro VChart with a spec containing a formatter or another supported callback.
  2. Update the component with a new callback while leaving the serializable fields unchanged.
  3. Alternatively, update with a spec containing a circular reference.
Current Behavior

Both componentDidUpdate implementations use JSON.stringify to decide whether the spec changed. Function-only changes compare equal, so updateSpec is not called. Circular specs throw during the lifecycle method instead of reaching VChart.

Expected Behavior

Spec updates should use a comparison strategy that supports VChart's valid function-valued options and does not throw on cyclic input.

Environment
  • OS: Windows 11
  • Node.js: 20.20.2 and 24.14.1
  • Package: @visactor/taro-vchart
Any additional comments?

The comparison has existed since the component's initial implementation, and this package currently has no unit tests covering update behavior. A fix should choose and test the intended function-diff and cyclic-object semantics rather than replacing the guard without measuring update cost.

Related: #4254 reports that serializable spec updates do not refresh under Taro 4.x. This report isolates two comparator behaviors that are present in the wrapper code independent of Taro version: function-only changes compare equal and cyclic input throws. #4254 has no linked PR or commit and does not mention either comparator case.

I searched all 4,627 open/closed issues and pull requests locally after fetching their current metadata, including Taro spec updates, JSON.stringify, function specs, circular specs, and general-chart; I also reviewed the file history and repository Discussions (none). Apart from the broader #4254 above, I did not find an existing report or fix for these two cases.

Dominant language
TypeScript
Stars
1.8k
Forks
219
Avg merge
14h 59m
Merged PRs (30d)
17

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from VisActor/VChart

All issues in VisActor/VChart

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.