Skip to content

Refactor Vue 3 integration guide to use composables pattern#1657

Draft
sequba wants to merge 1 commit intofeature/hf-122-framework-integration-guidesfrom
claude/review-vue-integration-guide-EF500
Draft

Refactor Vue 3 integration guide to use composables pattern#1657
sequba wants to merge 1 commit intofeature/hf-122-framework-integration-guidesfrom
claude/review-vue-integration-guide-EF500

Conversation

@sequba
Copy link
Copy Markdown
Contributor

@sequba sequba commented Apr 20, 2026

Context

The Vue 3 integration guide was using an outdated pattern with a plain class wrapper (SpreadsheetProvider) to keep the HyperFormula instance outside Vue's reactivity system. This approach is less idiomatic for modern Vue 3 development.

The guide has been updated to demonstrate the recommended composable pattern, which is the standard way to encapsulate stateful logic in Vue 3. This change also improves the clarity of the troubleshooting section by better explaining when and why markRaw is needed.

How did you test your changes?

Documentation review only. The changes are instructional updates to the integration guide with no functional code changes to the library itself.

Types of changes

  • Change to the documentation

Related issues:

None

Checklist:

  • I have reviewed the guidelines about Contributing to HyperFormula and I confirm that my code follows the code style of this project.
  • My changes require a documentation update.

Summary of changes

  • Replaced the class-based SpreadsheetProvider pattern with a composable function useSpreadsheet
  • Updated the example component to use the composable with <script setup>
  • Improved explanations of Vue 3 reactivity opt-in behavior and shallowRef usage
  • Enhanced the troubleshooting section with clearer guidance on when markRaw is needed vs. when it's unnecessary
  • Added a code example for Nuxt's <ClientOnly> wrapper with proper context
  • Added type="button" attributes to button elements for better HTML semantics

https://claude.ai/code/session_01FBwp6T1sLtGPiWUKHMn8hH

Switch the basic example from a class wrapper to a composable, the
idiomatic Vue 3 pattern for stateful reuse. Correct the reactivity
explanation: TypeScript's `private` is erased at compile time, so the
class did not actually shield the instance from Vue's Proxy — what
keeps the engine out of reactivity is simply not passing it to
ref()/reactive(). Use shallowRef for the values grid so reassignment
triggers re-renders without deep-proxying every row. Use HyperFormula's
own Sheet and CellValue types instead of hand-rolled unions. Expand
the markRaw section to clarify when it is and isn't needed.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.18%. Comparing base (d6a316c) to head (443c87b).

Additional details and impacted files

Impacted file tree graph

@@                             Coverage Diff                              @@
##           feature/hf-122-framework-integration-guides    #1657   +/-   ##
============================================================================
  Coverage                                        97.18%   97.18%           
============================================================================
  Files                                              174      174           
  Lines                                            15086    15086           
  Branches                                          3223     3223           
============================================================================
  Hits                                             14662    14662           
  Misses                                             424      424           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

Performance comparison of head (443c87b) vs base (d6a316c)

                                     testName |   base |   head | change
------------------------------------------------------------------------
                                      Sheet A | 483.55 | 487.68 | +0.85%
                                      Sheet B | 155.55 |  154.3 | -0.80%
                                      Sheet T | 136.05 |  137.4 | +0.99%
                                Column ranges | 463.97 | 465.12 | +0.25%
Sheet A:  change value, add/remove row/column |  14.54 |  14.65 | +0.76%
 Sheet B: change value, add/remove row/column | 125.74 | 128.58 | +2.26%
                   Column ranges - add column | 139.44 | 146.53 | +5.08%
                Column ranges - without batch | 427.35 | 428.08 | +0.17%
                        Column ranges - batch | 110.61 | 109.46 | -1.04%

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.

2 participants