-
-
Notifications
You must be signed in to change notification settings - Fork 928
Single component redraw fix #743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6dafefd
Single component redraw fix
dhinesh03 be60f8c
Js lint error clean up
dhinesh03 c0972ba
Removed trailing whitespace and added space after comma
dhinesh03 44f0310
Necessary config functions has been invoked after self-redraw
dhinesh03 11dc7c2
configs - array not initialized while self redraw issue fixed
dhinesh03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -460,10 +460,18 @@ var m = (function app(window, undefined) { | |
| return data; | ||
| } | ||
|
|
||
| function buildObject(data, cached, editable, parentElement, index, shouldReattach, namespace, configs) { | ||
| function makeRedrawSelf(controller,view,parentElement, parentTag, parentCache, parentIndex, newData, cached, shouldReattach, index, editable, namespace, configs) { | ||
| return function() { | ||
| m.redraw.strategy('none'); | ||
| var newData = view(controller); | ||
| build(parentElement, parentTag, parentCache, parentIndex, newData, cached, shouldReattach, index, editable, namespace, configs); | ||
| } | ||
| } | ||
|
|
||
| function buildObject(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) { | ||
| var views = [], controllers = []; | ||
| data = markViews(data, cached, views, controllers); | ||
| if (!data.tag && controllers.length) throw new Error("Component template must return a virtual element, not an array, string, etc."); | ||
| if (!data.tag && controllers.length) throw new Error("Component template must return a virtual element, not an array, string, etc."); | ||
| data.attrs = data.attrs || {}; | ||
| cached.attrs = cached.attrs || {}; | ||
| var dataAttrKeys = Object.keys(data.attrs); | ||
|
|
@@ -487,6 +495,15 @@ var m = (function app(window, undefined) { | |
| //schedule configs to be called. They are called after `build` | ||
| //finishes running | ||
| scheduleConfigsToBeCalled(configs, data, node, isNew, cached); | ||
|
|
||
| // Single component redraw fix | ||
| for (var i = 0; i < controllers.length; i++) { | ||
| var controller = controllers[i]; | ||
| if (isFunction(controller.redrawSelf)) { | ||
| controller.redrawSelf = makeRedrawSelf(controller,views[i],parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need spaces after commas |
||
| } | ||
| } | ||
|
|
||
| return cached | ||
| } | ||
|
|
||
|
|
@@ -544,7 +561,7 @@ var m = (function app(window, undefined) { | |
| if (data.subtree === "retain") return cached; | ||
| cached = makeCache(data, cached, index, parentIndex, parentCache); | ||
| return isArray(data) ? buildArray(data, cached, parentElement, index, parentTag, shouldReattach, editable, namespace, configs) : | ||
| data != null && isObject(data) ? buildObject(data, cached, editable, parentElement, index, shouldReattach, namespace, configs) : | ||
| data != null && isObject(data) ? buildObject(parentElement, parentTag, parentCache, parentIndex, data, cached, shouldReattach, index, editable, namespace, configs) : | ||
| !isFunction(data) ? handleText(cached, data, index, parentElement, shouldReattach, editable, parentTag) : | ||
| cached; | ||
| } | ||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace