Skip to content

compare mapping against parent if it exists#125

Merged
ryanbrainard merged 2 commits intoheroku:masterfrom
nfcampos:parent-comparison
May 27, 2016
Merged

compare mapping against parent if it exists#125
ryanbrainard merged 2 commits intoheroku:masterfrom
nfcampos:parent-comparison

Conversation

@nfcampos
Copy link
Copy Markdown
Contributor

  • basically just compares new mappings against the parent (if it exists). only goes one level deep so if you have
{
  foo: {
    url: '/foo',
    then: () => ({
      url: '/then',
      then: () => ({
        url: '/thenthen'
      })
    })
  }
}

it'll still be broken

  • missing a test for this, don't merge yet

closes #102

what do you think of this solution @ryanbrainard ?

@ryanbrainard
Copy link
Copy Markdown
Contributor

Hmm...yeah, I think that'll work. Might need to think on it. Also, maybe parent should always be the top-level mapping as to work in cases with multi-level chains?

@nfcampos nfcampos force-pushed the parent-comparison branch from ec0eeb4 to 23db926 Compare May 25, 2016 18:36
@nfcampos
Copy link
Copy Markdown
Contributor Author

Yeah I agree parent should always be the top level mapping

@nfcampos
Copy link
Copy Markdown
Contributor Author

the cleanest way to do that is to save a reference to parent (if it exists) in each mapping, inside coerceMapping, any reason not to do that?
like this:
screenshot 2016-05-25 19 40 31

@ryanbrainard
Copy link
Copy Markdown
Contributor

Seems like that should work

@ryanbrainard
Copy link
Copy Markdown
Contributor

Thanks!

@ryanbrainard ryanbrainard merged commit f5135f5 into heroku:master May 27, 2016
@nfcampos nfcampos deleted the parent-comparison branch May 27, 2016 21:16
@nfcampos nfcampos mentioned this pull request May 27, 2016
ryanbrainard added a commit that referenced this pull request May 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

request shallow comparison with then() should compare the original mapping?

2 participants