You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my case, I have Records with a constructor and because of the initialisation of the Record with {}, I can't use default parameters ({ meta : {} }) and need to check if my nested object structures exist everywhere (data.meta && data.meta.title || ...):
exportdefaultclassStartPageextendsStartPageRecord{constructor(data={meta : {}},name){// this here won't worksuper({
...data,selected : newSet(data.selected),image : newImage(data.image),meta : newMeta({title : data.meta.title||data.title,// these throw errorsdescription : data.meta.description||data.subtitle// because data.meta is undefined}),socialLinks : newSocialLinks(data.socialLinks)},name)}}
The text was updated successfully, but these errors were encountered:
I expect I would have done this because a record wouldn't instantiate without the values, but that doesn't seem to be the case anymore (if it even ever was).
Hey there!
Great library, I just have one little problem/question about this line of code: see https://github.com/glenjamin/transit-immutable-js/blob/master/index.js#L215
Is there a reason for initialising the Records there? Or rather: is there a reason for initialising them with an empty Object (
{}
)?In my case, I have Records with a constructor and because of the initialisation of the Record with
{}
, I can't use default parameters ({ meta : {} }
) and need to check if my nested object structures exist everywhere (data.meta && data.meta.title || ...
):The text was updated successfully, but these errors were encountered: