Add something like `is_leaf` Boolean field to serialized ContentNodes to replace common "leaf or branch" checks in JS code
See original GitHub issueIn the ContentNodeViewSet
(and other related viewsets), it would be nice to have a field like is_leaf
that returns true
whenever the node is a resource/leaf and false
if it is a topic or a channel.
There are dozens of places in the JS code where we have to check if this is the case based on the kind
field that could be simplified if we had this field.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
prosemirror-demo/0.15.0.html at master - GitHub
default) nodes get dropped when their entire content is replaced,. whereas defining nodes persist and wrap the inserted content. Likewise, the the <em> ......
Read more >https://fit.ijf.org/assets/b/javascript.e85c570d.j...
modules are defined as an array // [ module function, map of requires ] // // map of requires is short require name...
Read more >Collaborative JavaScript Debugging - JS Bin
A live pastebin for HTML, CSS & JavaScript and a range of processors, including SCSS, CoffeeScript, Jade and more...
Read more >Fast and easy JSON output: using the new JSON serializer
Using the serializer is as simple as adding a serialization declaration to the top of an XQuery: declare option exist:serialize "method=json ...
Read more >Rev 2807 and /web/ Rev 2808 - WebSVN – ALCASAR
events, perform animations, and add Ajax interactions to your web pages. USED : used for the entire userinterface. jquery.dataTables.js.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Noting that on the backend
TOPIC
should be the kind on every node that isn’t a leaf node (even the channel root node), wherever the specialCHANNEL
kind is being set it is only on the frontend.So, the annotated field on the ContentNodeViewset would just be a simple boolean check of
kind == 'TOPIC'
.Yes, that’s right. I think we can even safely replace the
kind === ContentNodeKinds.TOPIC
check (without the check forCHANNEL
) in most places as well.