Skip to content
Discussion options

You must be logged in to vote

init runs too early when persist is not the persisted value yet. You need to use nextTick

init() {
  Alpine.nextTick(() => {
    console.log(this.activeFontSizeClassName); 
    document.documentElement.classList.add(this.activeFontSizeClassName);
  })
}

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@ekwoka
Comment options

@SimoTod
Comment options

SimoTod Jun 2, 2024
Collaborator

@bashunaimiroy
Comment options

@SimoTod
Comment options

SimoTod Jun 27, 2024
Collaborator

@ekwoka
Comment options

Answer selected by arthurshlain
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants