Immer: Option to always invoke getters

Created on 23 Apr 2020  路  3Comments  路  Source: immerjs/immer

馃檵鈥嶁檪 Question

Follow up to this thread: https://github.com/immerjs/immer/issues/317

Where I am using immer is somewhat different to most use cases I would imagine. The application I am working on is set up with a micro front end style of architecture. We have a "shell" application with a global redux store that brings them all in and individual apps can be of any framework. We are mostly vuejs right now, which is where the issue comes. Due to this line: https://github.com/immerjs/immer/blob/0d87fc88e8efffdacbb5db295cb9efd624cd2757/src/utils/common.ts#L159

Would it be possible to have an option to always call the get function? Our redux store lives outside of the vue application and thus has no need for the reactivity that vue is adding with it's getter/setters. So far we have gotten around this by using patch-package to edit immer and remove the error throw. With version 6+ of immer, it doesn't look to be viable anymore as the code being bundled is all minified/uglified.

Would certainly be willing to make a contribution if this is something that can be added.

has PR question released should-be-fixed-by-immer-7

Most helpful comment

馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀
馃挏 I LOVE YOU 馃挏 I LOVE YOU 馃挏 I LOVE YOU 馃挏
馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀

All 3 comments

@vidarc

I have similar requirements. It's much more painful than it used to be.

The only way I could get it working was by the following steps:

  1. clone the immer repo
  2. checkout the tag for the target version
  3. make the change to the src
  4. build the project
  5. copy the dist folder over the dist folder in my node_modules/immer
  6. run patch-package against a few key files.

It's much more of a maintenance pain and the patch is far larger. I worry it scares people who look at it.

I dream of getters being configurably supported, but can respect they are not in scope for this project.

If you work out a better way please let me know.

:tada: This issue has been resolved in version 7.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀
馃挏 I LOVE YOU 馃挏 I LOVE YOU 馃挏 I LOVE YOU 馃挏
馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀馃帀

Was this page helpful?
0 / 5 - 0 ratings