Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/storePublic

🐞[BUG]: NGXS Migration to existing local storage state #2384

Open
@MadEddieFFS

Description

@MadEddieFFS

We have our state persisted to local storage and currently do not use migrations. This state therefore does not have a version tag.

As we must specify a version in the migration as a string|number it seems the migration never runs. I would like to initially change a defaulted value in the state with this migration

export const callHistoryMigrations = [
{
version: 0,
key: 'callhistory',
versionKey: 'version',
migrate: (state:any) => {
return {
...state,
missedCallsCount: 100,
version: 1
};
}
}
];

but it doesn't run. I added the version field to my state model and the defaults.

Looking at the code in ngxs-storage the getValue would never work as it would be comparing version 0 to undefined:

const versionMatch =
strategy.version === getValue(storedValue, strategy.versionKey || 'version');

which is: const versionMatch = 0 === undefined;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp