question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to access to nested field when field is null

See original GitHub issue
const values = null;

const fields = [
  'hotel.name',
  'hotel.starRating',
];

const form = new Form({ fields, values });

console.log(form.$('hotel.name').value); // Error

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
foxhound87commented, Oct 24, 2016

Now should work as expected! Let me know, thank you.

0reactions
foxhound87commented, Oct 25, 2016

I don’t get the same result (it’s correct for me):

console.log('fixes/form.c.js', $.$C.$('itineraryItems').values());
[ 
  { hotel: { name: 'The Plaza', starRating: '4.0' } },
  { hotel: { name: 'Beverly Hills Hotel', starRating: '5.0' } },
  { hotel: { name: 'Trump Hotel', starRating: '5.0' } } 
]
console.log('fixes/form.d.js', $.$D.$('itineraryItems').values());
[
  { hotel: { name: 'New Test Name', starRating: '5.0' } },
  { hotel: { name: 'New Test Name', starRating: '5.0' } },
  { hotel: { name: 'New Test Name', starRating: '5.0' } } 
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Nested object is getting null while submitting form
Looking at your HTML logic. I suspect issue is in Project Loop. You are defining th:field="*{project}" but using as pro in option.
Read more >
Sorting on an unmapped nested field throws an error
I'm trying to sort on unmapped nested fields. Due to our dynamic_template i run into the issue, that i do not have the...
Read more >
Handling Nulls in nested objects (Java) - Lalit Vatsal - Medium
Suppose we have a simple but nested object structure like: ... The only problem is we cannot control and determine which stage failed...
Read more >
How to handle deeply-nested nullable fields in JavaScript and ...
Option 1: Enter idx​​ I have found idx to be a safe method of accessing these nested nullable values. A naive implementation of...
Read more >
Minor bug in NestedField if nested serializer allows empty data
I ran into an issue using NestedFields when it wraps a serializer that allows no data body when POSTing. What I want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found