Skip to content

Commit

Permalink
Update alpine.md with better info about proxy limitations
Browse files Browse the repository at this point in the history
The issue described in #1515 is now mentioned in the Alpine documentation so that readers understand why the example does not store the editor as component data and why they should not do so either.
  • Loading branch information
justisr committed Dec 9, 2023
1 parent fc67cb1 commit 4eda0a5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/installation/alpine.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import StarterKit from '@tiptap/starter-kit'

document.addEventListener('alpine:init', () => {
Alpine.data('editor', (content) => {
let editor
let editor // Alpine's reactive engine automatically wraps component properties in proxy objects. Attempting to use a proxied editor instance to apply a transaction will cause a "Range Error: Applying a mismatched transaction", so be sure to unwrap it using Alpine.raw(), or simply avoid storing your editor as a component property, as shown in this example.

return {
updatedAt: Date.now(), // force Alpine to rerender on selection change
Expand Down

0 comments on commit 4eda0a5

Please sign in to comment.