Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is to help us find bugs that are currently escaping notice by confining all bugs and defects to within a particular edit. This is done by preventing any corruption of the cache that is currently happening when people edit objects retrieved from the cache.
Architecture
edit.js
anddb.js
have been moved to their own edit folder. Edit.js has become index.js, and should be referred to asrequire('./services/edit')
. Ideally, db.js will never be referred to, but all actions will be made discrete inside edit.js and well tested. (hahaha! right? :p)data
, since we always have_ref
at the base to say where this object should be saved. Creating a new components still takes two parameters (uri, data).{value, _schema}
. A convenience function has been exposed calledtoClayKilnStyle
that can help temporarily until we get everyone being consistent, and it's already marked as deprecated and also logs a warning when it is used. It's currently being used in the forms.js, which apparently hasn't changed in a very long time.['_ref', '_groups' '_self', '_components', '_pageRef', '_pageData', '_version', '_refs', 'layout', 'template']
. We use those for special things.cache.js
has been added into the edit folder. All things that are cached for editing go there. All functions are cached in some way, and all functions return read-only values.control.js
has been added into the edit folder. All things that constrain objects go there. It has two functions:Bug Fixes
edit.js
getData and getDataOnly return clones of the cached values.db.js
uses HTML5 events for send function instead of 1998'sonreadystatechange
.Note: This will break things on purpose to highlight our mistakes, so they can be corrected more easily. That said, I can't seem to find anything broken at the moment. I can edit tags, edit headlines, and edit paragraphs.