gpbl / denormalizr

Denormalize data normalized with normalizr
https://www.npmjs.com/package/denormalizr
MIT License
228 stars 24 forks source link

Update readme? Normalizr denormalize doesn't handle recursive models, denormalizr still useful for that. #40

Closed dkrieger closed 7 years ago

dkrieger commented 7 years ago

Normalizr can normalize recursive models, but can't denormalize them -- there was a commit to allow it, but it caused a regression and was reverted several months ago. If nothing else it might be worthwhile to mention this as a valid use case even though it is otherwise deprecated. Just a thought, totally understand if it's not worth reviving/maintaining the project.

gpbl commented 7 years ago

Ah I didn't know that, thanks for the heads up. I'm OK to de-deprecate denormalizr! (is this even possible on npm?)

paularmstrong commented 7 years ago

@dkrieger I'm pretty sure we merged the PR that fixed it. https://github.com/paularmstrong/normalizr/commit/ff7d52164e08354f201607cf24cb531d6d585079 & https://github.com/paularmstrong/normalizr/commit/066dc847ecb9d774966003e50162390e9185ca56

From the docs: https://github.com/paularmstrong/normalizr/blob/master/docs/api.md#denormalizeinput-schema-entities

If your schema and data have recursive references, only the first instance of an entity will be given. Subsequent references will be returned as the id provided.

If there's still a problem, can you open an issue, or maybe try to fix it in a PR?

dkrieger commented 7 years ago

@paularmstrong I discovered the root of the issue and opened an issue. From reading older closed issues I thought the feature was put on hold indefinitely, I didn't realize it had been implemented and just had an unreported bug. This is definitely an edge case that I can work around for now, I'm closing this issue @gpbl