Optional chaining is in stage 1 and can be found in this repo. Optional Chaining provides a succinct way to check for the existence of an object before accessing its properties. Very similar to the C# null conditional operator. And it is already available in the React ecosystem.
Why do we need this?
I had the good fortune to be able to attend the Codemash Conference again this year. Since the conference started more than 10 years ago, I have only missed it twice. As in past years, there were a number of good sessions over the four days of the conference. Over the next few weeks I will be blogging about a few of them. To start with, I want to talk about the session I attended on Chrome Dev Tools by Greg Malcolm (@gregmalcolm).
I have a client that needs to log any interactions with their customers in SharePoint. This client is proficient enough with SharePoint that they feel perfectly comfortable modifying lists in order to add or remove fields to accommodate their needs without having to go through us. They are regularly adding new fields to this log list in order to capture some new piece of relevant information that it was decided they needed. This is important background because when they approached me to create a way for them to generate multiple log entries from one “New Item” SharePoint List Form, I knew I couldn’t just create a custom “New Item” form to accomplish this or they would lose the ability to add new fields without having to either modify this custom “New Item” form, or involve us to make those modifications.
So I had to come up with a solution that would retain the standard “New Item” form (so any fields added/removed from the list would be reflected in the form) but would allow for the user to create an entry in their logs for every customer selected in the form.
I have a client that has over 50 subsites of the root site in a SharePoint site collection that are all pretty much the same. There’s a site for each county in the client’s state, each one with web parts to show some data from the root site that’s relevant to that specific county (contacts’ information, documents, that kind of thing). Whenever they wanted to make a change to, say, the contacts web part for these county site, they had to modify over fifty copies of the same web part. Tedious to say the least. After a few rounds of making these kind of repetitious modifications it was decided that I would need to come up with a solution to make managing this stuff much easier.
So I did.
The idea is that you pass the class/function/attribute through a function and the result becomes the class/function/attribute.
As an example, if you make a @final decorator and have the code…