AdvancedCustomFields / AdvancedCustomFields/acf
model.setValue() does not trigger HTML re-render. Is it a bug?
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
I'm refactoring some piece of some old code where I use DOM traversing to change field's values programmatically. It works, however, I would prefer to use more elegant techniques if possible. I got excited a little that ACF has a new JS API, so I wanted to use it. I found there's a model.setValue() method, but It doesn't do what I expected it to do. ACF models look similar to Backbone models so I assumed that a change on the model will trigger HTML re-render, but it is not happening.
Is it a bug? Do I need to do anything else in order to get HTML re-rendered after calling model.setValue()? Or maybe model.setValue() is not supposed to be used this way and I still have to use good, old DOM traversing and update the HTML on my own?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ACF JavaScript API entry point for model.setValue() and trace whether changing a model is expected to update the HTML. Compare that behavior with the DOM-traversal approach described in the issue; done means confirming the supported re-render workflow or documenting that callers must update the DOM themselves.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100