-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Entity fully denormalizes & Entity -> FlatEntity for non-nested #328
Conversation
f239289
to
0e25690
Compare
Size Change: +90 B (0%) Total Size: 26.9 kB
ℹ️ View Unchanged
|
c631018
to
03a0268
Compare
@@ -233,17 +233,16 @@ describe(`${Entity.name} normalization`, () => { | |||
}); | |||
}); | |||
|
|||
/* TODO: This isn't supported quite yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note we re-enable this entire block. This has a lot of interested recursively nested denormalization cases.
@@ -32,14 +26,19 @@ import useSelectionUnstable from './react-integration/hooks/useSelection'; | |||
import hasUsableData from './react-integration/hooks/hasUsableData'; | |||
import { StateContext, DispatchContext } from './react-integration/context'; | |||
|
|||
export { | |||
Entity as NestedEntity, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remapping so there's no actual breaking changes for 'rest-hooks' itself (for now)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me! 👍
Fixes #301, #277, #165.
Motivation
Lacking full denormalization is a regression from recent consolidation. This allows for that.
Solution
pk
type.To maintain backwards compatibility, exports from 'rest-hooks' package itself will be
NestedEntity
andEntity
- that have previous behavior. New projects should importEntity
andFlatEntity
from@rest-hooks/normalizr
directly.Open questions
The next step is to make referential equality last more than one denorm call.
Entity, and it's schema members will need to be the keys mapping into a fully denormalized object. These should be freed from memory as soon as all other references to the fully denormalized object are lost.