select-snapshot icon indicating copy to clipboard operation
select-snapshot copied to clipboard

Still maintaned?

Open Blunderchips opened this issue 3 years ago • 12 comments

Is this project still under active development and if so is there project roadmap/plan publicly available with what features are planned?

Blunderchips avatar Mar 22 '21 17:03 Blunderchips

Yeah, I've published @ngxs-labs/[email protected] which is compatible with Angular 10.0.5+. Could you give it a try?

arturovt avatar Apr 20 '21 19:04 arturovt

Hello @arturovt sure thing, anything in particliar you would like me to test out?

Blunderchips avatar Apr 22 '21 19:04 Blunderchips

Can this be moved out of labs and into the core version?

jayordway avatar Jan 08 '22 17:01 jayordway

Can this be moved out of labs and into the core version?

This will be great ;) With this I can put all getters in one place and have much cleaner code

dewiktor2 avatar Jan 24 '22 09:01 dewiktor2

I've noticed that @SelectSnapshot() doesn't always return the latest value and we're in the process of removing it as it's unreliable.

roldengarm avatar May 11 '22 19:05 roldengarm

@roldengarm You may be interested in using a utility like the one I made in this playground (if you are using Ivy): https://stackblitz.com/edit/ngxs-select-dispatch-utils-v0-bmecrf?file=src/app/app.component.ts

It doesn't use a decorator, but the syntax is actually simpler, and more type-safe. The selectSnapshot util is also slightly different in that it returns a function which you invoke from the template to get the underlying value. PS. it would not trigger change detection for you when it changes, so you would need to be aware of this. Let me know what you think?

markwhitfeld avatar May 11 '22 21:05 markwhitfeld

@roldengarm Could we have more info on this if possible?

Are the cases where it doesn't return the latest value known? We are using it across our application, and reading this makes me a bit concerned. Should we refrain from using @SelectSnapshot() at all? Will there be a replacement? What about ViewSelectSnapshot(), does this one have the same problem?

Thanks.

mchlroy avatar Aug 04 '22 13:08 mchlroy

@mchlroy sorry for the late reply.

I couldn't pinpoint when it didn't work as expected, just noticed that it had the wrong value a couple of times. I've removed it entirely from our app.

roldengarm avatar Sep 08 '22 20:09 roldengarm

Has this been added to the core library or is there an alternative way to leverage such functionality in the latest version of ngxs/store?

jayordway avatar Oct 13 '22 14:10 jayordway

@jayordway I would recommend that you use the utility I linked in this comment:

https://stackblitz.com/edit/ngxs-select-dispatch-utils-v0-bmecrf?file=src/app/app.component.ts

It doesn't use a decorator, but the syntax is actually simpler, and more type-safe. The selectSnapshot util is also slightly different in that it returns a function which you invoke from the template to get the underlying value. PS. it would not trigger change detection for you when it changes, so you would need to be aware of this. Let me know what you think?

markwhitfeld avatar Oct 13 '22 15:10 markwhitfeld

Ok, this project is not maintained anymore? There is any plan to bring similar feature or this from link inside ngxs?

@jayordway I would recommend that you use the utility I linked in this comment:

https://stackblitz.com/edit/ngxs-select-dispatch-utils-v0-bmecrf?file=src/app/app.component.ts

It doesn't use a decorator, but the syntax is actually simpler, and more type-safe. The selectSnapshot util is also slightly different in that it returns a function which you invoke from the template to get the underlying value. PS. it would not trigger change detection for you when it changes, so you would need to be aware of this. Let me know what you think?

dewiktor2 avatar Oct 13 '22 15:10 dewiktor2

We would love feedback on this utility that I linked. You can add it into your project and use it. Depending on your angular version, you may need to change the ɵɵdirectiveInject to inject (now exposed in Angular 14).

The issue with the decorator approach of @SelectSnapshot and even @Select from the main library is that they lack the ability to provide type safety or type inference and they use a static global in order to gain access to the store. This causes issues with MFE apps and with server side rendering in some situations.

We would advise moving away from the decorator approach to the approach I linked in the example.

See this discussion on the proposed utils: https://github.com/ngxs/store/discussions/1923

markwhitfeld avatar Oct 13 '22 16:10 markwhitfeld