Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • kresus kresus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 142
    • Issues 142
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • kresusapp
  • kresuskresus
  • Issues
  • #1043
Closed
Open
Created Nov 30, 2020 by Antoine@ZeHiroDeveloper3 of 7 tasks completed3/7 tasks

Client store: replace updeep with immer

Currently, to keep the store immutable and to update it, we use updeep. However, this lib has several drawbacks:

  • the API is not very clear/user frienldy (not to say awful to use with highly nested stores)
  • the typing consistancy (to use with typescript) is not maintained with "complex" modifiers (ie the curried function ones).
  • the object prototype is not maintained when modifying an object (meaning we need to call new Constructor(candidate) and maybe reattach the external data (ie transactions for an account) to keep the data synced.

I had a look to Immer (here: https://immerjs.github.io/) which fixes all the drawbacks identified here (even if the ugliness of an API is a matter of personal taste):

  • modifying the state is as simple as modifying a plain object (https://immerjs.github.io/immer/docs/produce)
  • the types are well infered with typescript (https://immerjs.github.io/immer/docs/typescript)
  • it is possible to easily tell immer to keep the prototype of an object. (https://immerjs.github.io/immer/docs/complex-objects)

I also tested it, and works well (I did not see any problems from now). Implementation

  • Categories : merged
  • Budgets: merged
  • Instance: @ZeHiro
  • Settings : @ZeHiro
  • Banks : @bnjbvr
  • Types: @bnjbvr
  • UI : @bnjbvr
Edited Dec 20, 2020 by Benjamin Bouvier
Assignee
Assign to
Time tracking