Q42 / Q42/Template.ComposeMultiplatform

Standardize ViewStateString usage and documentation in project template

Open
#224 0 comments 0 reactions 1 assignee View on GitHub

@tom0334 is already working on this.

Since Sep 18, 2026.

documentation enhancement
Dominant language
Kotlin
Stars
1
Forks
0
Avg merge
7d 15h
Merged PRs (30d)
15

Description

Type: Refactoring / Technical Debt

Description:

Currently, there are mixed conventions across our Android / CMP codebase regarding where and how ViewStateString is unwrapped. In several places, elementary Composables take ViewStateString parameters directly, or static strings are constructed via ViewStateString("...").get() directly inside UI components. To improve component reusability, testability, and maintain consistency across project templates, we need to enforce clear conventions on string unwrapping and document them properly.

Agreed Conventions
  • Unwrap strings early: Composables (especially elementary/reusable UI components) should accept standard String parameters, not ViewStateString. Unwrapping should occur near the top level where the ViewState is observed.
  • No ViewStateString in Composable parameters: Keep UI components "blissfully unaware" of the string source (resource vs. dynamic string vs. hardcoded).
  • Avoid redundant unwrapping: Do not instantiate ViewStateString only to immediately call .get() inside a Composable for static text. Use native string resource resolution or direct strings instead.
Tasks

[ ] Refactor Template Codebase: Update current usages of ViewStateString across the project template to align with the agreed rules.
[ ] Add KDoc Documentation: Update ViewStateString class docs to explicitly detail its intended usage and state where unwrapping should occur.
[ ] Update Guidelines: Add clear instructions and examples regarding string unwrapping conventions in agents.md (and relevant architecture docs).

Context

https://q42.slack.com/archives/C02BT66BX/p1789371443383889

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.