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

Default to using copies of state, instead of patches #9

Merged
merged 35 commits into from
May 30, 2024
Merged

Conversation

EskiMojo14
Copy link
Owner

@EskiMojo14 EskiMojo14 commented Apr 27, 2024

Patches seem to end up being bigger than just keeping a copy of state, unless the state is particularly large. Defaulting to keeping a copy, and instead exposing a specific version that uses patches, makes sense.

Breaking changes

  • createHistoryAdapter now uses entire copies of state, rather than patches of changes
    • createPatchHistoryAdapter available for previous behaviour
    • similarly, HistoryState no longer uses patches, whereas PatchHistoryState does
  • Second argument for undoable can no longer be isUndoable function - needs to be config object

Other changes

  • Build is no longer minified, allowing for better minification in the user's bundler
  • API to create custom adapters exported

Copy link

github-actions bot commented Apr 27, 2024

size-limit report 📦

Path Size
history-adapter 3.91 KB (+3.31% 🔺)
history-adapter (CJS) 4.8 KB (+3.43% 🔺)
history-adapter/redux 4.3 KB (+4.07% 🔺)
import { createHistoryAdapter } from 'history-adapter' 3.06 KB (-18.69% 🔽)
import { createHistoryAdapter } from 'history-adapter/redux' 3.27 KB (-17.55% 🔽)
import { createPatchHistoryAdapter } from 'history-adapter' 3.84 KB (+100% 🔺)
import { buildCreateHistoryAdapter } from 'history-adapter' 2.99 KB (+100% 🔺)
import { createPatchHistoryAdapter } from 'history-adapter/redux' 4.05 KB (+100% 🔺)

@EskiMojo14 EskiMojo14 changed the title add createNoPatchHistoryAdapter Default to using copies of history, instead of patches May 29, 2024
@EskiMojo14 EskiMojo14 changed the title Default to using copies of history, instead of patches Default to using copies of state, instead of patches May 30, 2024
@EskiMojo14 EskiMojo14 merged commit 7f07376 into main May 30, 2024
1 check passed
@EskiMojo14 EskiMojo14 deleted the non-patch branch May 30, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant