Skip to content

Changed type parameter T in NavStateSaver to nullable#1009

Merged
arkivanov merged 1 commit into
masterfrom
07-04-changed_type_parameter_t_in_navstatesaver_to_nullable
Jul 4, 2026
Merged

Changed type parameter T in NavStateSaver to nullable#1009
arkivanov merged 1 commit into
masterfrom
07-04-changed_type_parameter_t_in_navstatesaver_to_nullable

Conversation

@arkivanov

@arkivanov arkivanov commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • NavStateSaver now supports nullable configuration values.
    • Convenience builders were updated to work with both nullable and non-nullable types, while keeping serialization behavior the same.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 228749c5-c57a-45d0-a468-3899c440a5a8

📥 Commits

Reviewing files that changed from the base of the PR and between 01b654c and 75aff7a.

📒 Files selected for processing (2)
  • decompose/api/decompose.klib.api
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/NavStateSaver.kt
🚧 Files skipped from review as they are similar to previous changes (2)
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/NavStateSaver.kt
  • decompose/api/decompose.klib.api

📝 Walkthrough

Walkthrough

The NavStateSaver interface and its builder functions relax the generic type constraint from Any to nullable Any?, allowing nullable configuration types. The serializer-based builder uses KSerializer<T & Any> to preserve non-null serialization requirements. Public API dumps are updated accordingly.

Changes

Nullable NavStateSaver support

Layer / File(s) Summary
NavStateSaver implementation generic relaxation
decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/NavStateSaver.kt
The NavStateSaver interface and its save/restore builder drop the T : Any constraint, and the serializer-based builder changes to fun <T> with KSerializer<T & Any> while preserving the same save/restore logic.
Public API dump updates
decompose/api/decompose.klib.api
The interface, factory, and inline builder signatures for NavStateSaver are updated in the API dump to reflect the nullable generic bound and adjusted serializer parameter type, with the NavStateSaver(KSerializer<...>) factory repositioned relative to transientNavStateSaver().

Estimated code review effort: 2 (Simple) | ~10 minutes

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: making NavStateSaver's type parameter nullable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-04-changed_type_parameter_t_in_navstatesaver_to_nullable

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arkivanov arkivanov force-pushed the 07-04-changed_type_parameter_t_in_navstatesaver_to_nullable branch from 90fbd7e to 01b654c Compare July 4, 2026 20:47
@arkivanov arkivanov marked this pull request as ready for review July 4, 2026 20:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/NavStateSaver.kt`:
- Around line 50-57: The NavStateSaver serializer overload currently wraps every
state in SerializableContainer even when the saved value is null, but the
serializer passed to NavStateSaver(serializer) is non-null. Update this overload
to handle nullable values by returning null before calling SerializableContainer
in the save lambda, or otherwise narrow the generic so NavStateSaver only
accepts non-null T; use the NavStateSaver and SerializableContainer symbols to
locate the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e79bc770-6dbc-44da-bcdf-e728ea42120a

📥 Commits

Reviewing files that changed from the base of the PR and between 1a2f625 and 01b654c.

📒 Files selected for processing (2)
  • decompose/api/decompose.klib.api
  • decompose/src/commonMain/kotlin/com/arkivanov/decompose/router/children/NavStateSaver.kt

arkivanov commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author

Merge activity

  • Jul 4, 9:51 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 4, 9:53 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 4, 10:11 PM UTC: @arkivanov merged this pull request with Graphite.

@arkivanov arkivanov force-pushed the 07-04-changed_type_parameter_t_in_navstatesaver_to_nullable branch from 01b654c to 75aff7a Compare July 4, 2026 21:52
@arkivanov arkivanov merged commit f7508a2 into master Jul 4, 2026
3 checks passed
@arkivanov arkivanov deleted the 07-04-changed_type_parameter_t_in_navstatesaver_to_nullable branch July 4, 2026 22:11
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