feat(changelog): remember the newest change the reader has seen
First-run setup marks a new reader up to date, since changes mean nothing before you've used the app. An absent marker therefore means an install from before the changelog, which is what lets the launch be announced to existing readers once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
238d21686a
commit
a74bbd3efe
@@ -63,3 +63,22 @@ describe("what a reader has not seen", () => {
|
||||
expect(compareUrl("https://r", "a1b2c3d", "e4f5a6b")).toBe("https://r/compare/a1b2c3d...e4f5a6b");
|
||||
});
|
||||
});
|
||||
|
||||
describe("the seen marker in prefs", () => {
|
||||
test("restore keeps a string and drops anything else", async () => {
|
||||
const { restorePrefsValue } = await import("../src/client/state/usePrefs.ts");
|
||||
expect(restorePrefsValue({ changelogSeen: "check-in-goals" }).changelogSeen).toBe("check-in-goals");
|
||||
expect(restorePrefsValue({ changelogSeen: 7 }).changelogSeen).toBeUndefined();
|
||||
expect(restorePrefsValue({}).changelogSeen).toBeUndefined();
|
||||
});
|
||||
|
||||
test("first-run setup marks everything seen", async () => {
|
||||
const { firstRunPrefs } = await import("../src/client/state/usePrefs.ts");
|
||||
expect(firstRunPrefs(["genshin", "hsr"], ["hsr"], "soon")).toEqual({
|
||||
onboarded: true,
|
||||
hiddenGames: ["genshin"],
|
||||
view: "soon",
|
||||
changelogSeen: newestId(ENTRIES),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user