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
refactor: Separate ui rendering from data updates #1692
Conversation
a2b3ad5
to
e817948
Compare
93d47e2
to
1990cb6
Compare
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.
👍
This is ready to be merged! |
@@ -0,0 +1,185 @@ | |||
import re |
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.
Maybe mv those tests in test_edit_map.py
instead of having a new module ?
@@ -1,397 +1,4 @@ | |||
describe('L.Util', function () { |
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.
I'm surprised to see all those tests removed here ? Should this have been done in that other PR moving utils to a module ? Or is this just missing a rebase ?
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.
yep, it's broken in the current master, and fixed here! 🙈
`U.SCHEMA` now contains an `impacts` key, which makes it possible to specify what part of the UI is impacted by data changes. A new `render` method has been added on `U.Map` and `U.DataLayer`, which is used to rerender the proper parts of the UI depending on the passed properties. `U.FormBuilder` calls this `render()` method (if present), during form changes.
There are now multiple elements accessed with the same CSS selector.
It was currently looked for in the uMap utils, where it wasn't present.
Also: - move the `type` key before the `impacts` one. - avoid one-line objects
U.SCHEMA
now contains animpacts
key, which makes it possible to specify what part of the UI is impacted by data changes.A new
render
method has been added onU.Map
andU.DataLayer
, which is used to rerender the proper parts of the UI depending on the passed properties.U.FormBuilder
calls thisrender()
method (if present), during form changes.Note
This approach is less specific than a previous one in order to a) not tie the schema to specific callbacks and b) not repeat properties in two different places.
The resulting code is less conservative when considering which parts of the UI are updated when receiving updates, thus rerendering parts of the UI which might not be in need of rerender. The hope is that it won't be a problem, but let's keep our eyes open.
Progress
ChoroplethLayer.onEdit
is expecting to be passed the builderimpacts = []
everywhere (remove['']
occurrences)