Skip to content
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

Add type parameter for Id in createEntityAdapter #2099

Conversation

Matt-Ord
Copy link
Contributor

@Matt-Ord Matt-Ord commented Mar 5, 2022

Fixes issue #2098
Let me know if this change also needs any docs/ I've messed up the system for creating a PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 5, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0e79626:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration

@netlify
Copy link

netlify bot commented Mar 5, 2022

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit 0e79626
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/624b2f9024112e000828c2cb
😎 Deploy Preview https://deploy-preview-2099--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@phryneas
Copy link
Member

phryneas commented Apr 1, 2022

I've gone over this - from my side it's okay @markerikson .
I've also roughly gone over #948 in the context of this - it doesn't seem like the types changes would overlap too much, probably a few types would get one new type argument from each PR, but most would be affected by only one of the two PRs.

@Matt-Ord
Copy link
Contributor Author

Matt-Ord commented Apr 2, 2022

Do I need to do anything to update the docs- I think currently they have still have the old types. Also is there any point keeping the DictionaryNum type around still?

@@ -24,7 +24,7 @@ export type Dictionary<T, Id extends EntityId> = Partial<Record<Id, T>>
/**
* @public
*/
export type DictionaryNum<T> = Dictionary<TemplateStringsArray, number>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that with this PR, this type could be pretty much completely removed - or only be kept for backwards compat, but not really referenced any more/

@phryneas
Copy link
Member

phryneas commented Apr 3, 2022

Yeah, docs PRs would be great where you see them necessary 👍

@Matt-Ord
Copy link
Contributor Author

Matt-Ord commented Apr 4, 2022

I think I've updated the docs where it's needed - it should be ready to go

@phryneas phryneas added this to the 1.9 milestone Jul 3, 2022
@markerikson markerikson changed the base branch from master to v1.9-integration August 11, 2022 02:56
@markerikson
Copy link
Collaborator

markerikson commented Aug 11, 2022

Hiya. I'm looking at this, and it seems like it makes some decidedly breaking changes to the types: it looks like we have to pass , Id everywhere (including existing public types), and it also rewrites the Dictionary type.

Given that, I don't think we can ship this in a 1.x release, unless I'm missing something.

Also, I'm realllly not sure about this line:

export type Dictionary<T, Id extends EntityId> = Partial<Record<Id, T>>

That looks funky to me

@markerikson markerikson modified the milestones: 1.9, 2.0 Aug 11, 2022
@Matt-Ord
Copy link
Contributor Author

I would agree this is probably a breaking change - although I think it will be 'worth it' when you come to a 2.0 release, since it's solved a real problem on a medium to large codebase I've been working on.

Ideally I would say swap the order of Id and T (and do the same on all types) but this would make it 'more breaking' - is this the issue you have with the dictionary type?

@markerikson markerikson deleted the branch reduxjs:v1.9-integration November 4, 2022 14:06
@markerikson markerikson closed this Nov 4, 2022
@Matt-Ord
Copy link
Contributor Author

Matt-Ord commented Nov 4, 2022

@markerikson Just seen this pr was closed - is this not something you want to change anymore? I'm happy to put the work in to update it if we're coming up to a 2.0 release?

@phryneas
Copy link
Member

phryneas commented Nov 4, 2022

I think this was just an accident. But funny enough, I don't have permissions to reopen ^^

@markerikson
Copy link
Collaborator

markerikson commented Nov 4, 2022

Uh. Yeah, I don't have permission to reopen it either! I think the issue is it was targeted to the v1.9 branch.

@Matt-Ord guess create a new PR? Go ahead and target master for now.

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.

3 participants