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

💡 Make update more fine grained about what to update #49

Open
pjechris opened this issue Jul 7, 2023 · 0 comments
Open

💡 Make update more fine grained about what to update #49

pjechris opened this issue Jul 7, 2023 · 0 comments
Labels
feature New feature or request

Comments

@pjechris
Copy link
Owner

pjechris commented Jul 7, 2023

Summary

Today when update closure is called the whole value is updated even if:

  • not all its relationships changed
  • maybe even nothing changed at all

Idea would be to:

  • do nothing when nothing changed (no update or update applied the same value)
  • only update what changed (if a nested entity did not change: do not update it)

Basic Example

// BEFORE: triggers an update on A and all its children
// AFTER: triggers nothing
identityMap.store(A.self, id: a.id) { _ in
}


// BEFORE: triggers an update on A, B and C
// AFTER: triggers an update on A and C (B did not change)
identityMap.store(A.self, id: a.id) {
  $0.b = $0.b
  $0.c = newValue
}

Unresolved questions

No response

@pjechris pjechris added the feature New feature or request label Jul 7, 2023
@pjechris pjechris changed the title 💡 Make update do nothing if nothing changed 💡 Make update more fine grained about what to update Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant