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

@ngrx/signals: Add migration schematic for props #4608

Closed
1 of 2 tasks
markostanimirovic opened this issue Nov 27, 2024 · 4 comments · Fixed by #4612
Closed
1 of 2 tasks

@ngrx/signals: Add migration schematic for props #4608

markostanimirovic opened this issue Nov 27, 2024 · 4 comments · Fixed by #4612
Assignees

Comments

@markostanimirovic
Copy link
Member

Which @ngrx/* package(s) are relevant/related to the feature request?

signals

Information

Add migration schematic for @ngrx/signals package that covers breaking changes made in this PR: #4607

  1. EntityComputed and NamedEntityComputed should be renamed to EntityProps and NamedEntityProps:
- import { EntityComputed, NamedEntityComputed } from '@ngrx/signals/entities';
+ import { EntityProps, NamedEntityProps } from '@ngrx/signals/entities';
  1. computed should be renamed to props in signalStoreFeature config:
// 2.a
export function withMyFeature() {
  return signalStoreFeature(
-    { computed: type<{ num: Signal<number> }>() },
+    { props: type<{ num: Signal<number> }>() },
    // ...
  );
}

// 2.b
export function withMyFeature() {
  return signalStoreFeature(
-    type<{ computed: { num: Signal<number> } }>(),
+    type<{ props: { num: Signal<number> } }>(),
    // ...
  );
}
  1. computed should be renamed to props in SignalStoreFeature generic arguments:
export function withMyFeature(): SignalStoreFeature<
-  { state: {}, computed: { num1: Signal<number> }, methods: {} },
-  { state: {}, computed: { num2: Signal<number> }, methods: {} },
+  { state: {}, props: { num1: Signal<number> }, methods: {} },
+  { state: {}, props: { num2: Signal<number> }, methods: {} },
\> {
  // ...
}

Describe any alternatives/workarounds you're currently using

_

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@rainerhahnekamp
Copy link
Contributor

If no one takes this by Saturday, I’ll work on it.

@PrajaktaB27
Copy link

Hello! I was taking a look at this issue and couldn't replicate it, looks like it's been resolved in the recently merged pr #4607?

@timdeschryver
Copy link
Member

@PrajaktaB27 #4607 has implemented props, this issue is to create a schematic to automatically migrate/update our user's codebase.

@rainerhahnekamp
Copy link
Contributor

Alright, then I'd like to take that one

@rainerhahnekamp rainerhahnekamp self-assigned this Nov 30, 2024
rainerhahnekamp added a commit to rainerhahnekamp/ngrx that referenced this issue Dec 1, 2024
This migration script, addressing ngrx#4608, will rename computed to props in the following scenarios:
- `signalStoreFeature({computed: type<{}>())`
- `signalStoreFeature(type<{computed: Signal<number>())`
- `SignalStoreFeature<{computed: {}}>`
- `EntityComputed` and `NamedEntityComputed`
rainerhahnekamp added a commit to rainerhahnekamp/ngrx that referenced this issue Dec 1, 2024
This migration script applies to an update to
version 19.0.0 RC 1.
It addresses ngrx#4608, and will rename `computed` to `props`
in the following scenarios:
- `signalStoreFeature({computed: type<{}>())`
- `signalStoreFeature(type<{computed: Signal<number>())`
- `SignalStoreFeature<{computed: {}}>`
- `EntityComputed` and `NamedEntityComputed`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants