{"id":13659563,"url":"https://github.com/theapache64/rebugger","last_synced_at":"2025-04-12T17:45:39.001Z","repository":{"id":149095283,"uuid":"619400431","full_name":"theapache64/rebugger","owner":"theapache64","description":"A simple Compose Multiplatform library designed to print the reason for recomposition in your console/Logcat window.\"","archived":false,"fork":false,"pushed_at":"2024-04-03T04:13:52.000Z","size":229,"stargazers_count":963,"open_issues_count":5,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-03T19:16:46.870Z","etag":null,"topics":["android","jetpack","jetpack-compose","recomposition"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theapache64.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-27T04:12:17.000Z","updated_at":"2025-04-03T16:35:39.000Z","dependencies_parsed_at":"2023-04-07T08:05:58.233Z","dependency_job_id":"b7df20af-e20a-4d4c-85b0-80195d154057","html_url":"https://github.com/theapache64/rebugger","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theapache64%2Frebugger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theapache64%2Frebugger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theapache64%2Frebugger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theapache64%2Frebugger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theapache64","download_url":"https://codeload.github.com/theapache64/rebugger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248609545,"owners_count":21132915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","jetpack","jetpack-compose","recomposition"],"created_at":"2024-08-02T05:01:10.096Z","updated_at":"2025-04-12T17:45:38.978Z","avatar_url":"https://github.com/theapache64.png","language":"Kotlin","readme":"# 🐞 Rebugger\n\n\u003e Rebugger : A recomposition debugger\n\nBeing a “compose dev” our enemy number one is unnecessary recompositions 🤕. Often times we use tools like [recompositionHighligher](https://github.com/theapache64/boil/blob/master/files/RecompositionHighlighter.kt), [LogComposition](https://github.com/theapache64/boil/blob/master/files/LogComposition.kt), and layout inspector to count the recomposition, but there’s no direct way to understand “why” the recomposition has happened.\n\nRebugger is a simple compose utility function that can track the change in the given arguments. It’ll print the reason for recomposition in your Logcat window.\n\n## ⌨️ Demo\n\n![](https://i.imgur.com/jztXzP9.png)\n\n## Usage\n\n### 1. Add dependencies\n\n[![latestVersion](https://maven-badges.herokuapp.com/maven-central/io.github.theapache64/rebugger/badge.svg)](https://mvnrepository.com/artifact/io.github.theapache64/rebugger)\n\n**Kotlin Script**\n\n```kotlin\nrepositories {\n    ...\n    mavenCentral()\n}\n\ndependencies {\n    implementation(\"io.github.theapache64:rebugger:1.0.0-rc03\")\n}\n```\n\n**Groovy**\n\n```groovy\nrepositories {\n    ...\n    mavenCentral() \n}\n\ndependencies {\n    implementation 'io.github.theapache64:rebugger:1.0.0-rc03'\n}\n```\n\n\n### 2. Add `Rebugger` call\n\n\u003e Call `Rebugger` with the states or args you want to track\n\n```kotlin\n@Composable\nfun VehicleUi(\n    car: Car,\n    bike: Bike,\n) {\n    var human by remember { mutableStateOf(Human(\"John\")) }\n\n    // Call Rebugger and pass the states you want to track. \n    // It could be a function arg or a state\n    Rebugger(\n        trackMap = mapOf(\n            \"car\" to car,\n            \"bike\" to bike,\n            \"human\" to human\n        ),\n    )\n    \n    //...\n```\n\n### 3. See `LogCat`\n\n\u003e Search for `Rebugger`\n\n![](https://i.imgur.com/jztXzP9.png)\n\n\n## 🖥 Sample Outputs\n\n- When Rebugger hooked into your composable, it’ll print something like this\n\n![image](https://user-images.githubusercontent.com/9678279/228623885-b0516fbd-518b-4135-9016-1928c57bc0c1.png)\n\n- When VehicleUi recomposes due to car instance change\n\n![image](https://user-images.githubusercontent.com/9678279/228624041-e6143b07-ca19-4c03-b49f-9b5bee7f936d.png)\n\n- When VehicleUi recomposes due to both  car and bike instance change\n\n![image](https://user-images.githubusercontent.com/9678279/228624288-498558a1-697a-46e7-99a6-e2c53ff1f975.png)\n\n- When VehicleUi recomposes due to human instance change (State within the composable)\n\n![image](https://user-images.githubusercontent.com/9678279/228624484-c1de1112-c13c-4b9b-8788-e2a4b917368e.png)\n\n## 🎨 Customization\n\nYou can use the `RebuggerConfig.init` function to override default properties of Rebugger. \n\n```kotlin\nclass App : Application() {\n    // ...\n    \n    override fun onCreate() {\n        super.onCreate()\n        \n        // ...\n        \n        RebuggerConfig.init(\n            tag = \"MyAppRebugger\", // changing default tag\n            logger = { tag, message -\u003e Timber.i(tag, message) } // use Timber for logging\n        )\n    }\n}\n```\n\n## 🔌 Plugin\n\nYou can use the [Rebugger IntelliJ plugin](https://plugins.jetbrains.com/plugin/21633-rebugger) to generate the `Rebugger` function call.\n\nhttps://user-images.githubusercontent.com/9678279/235495156-445e7ced-30fa-41dd-9b37-84b80502187f.mov\n\n\n## 🟠 Limitation\n\n### Auto Name Picking\n\nWhen Rebugger is placed deep inside the composable, it may not be able to pick the correct composable name. For example, if I place the Rebugger somewhere inside the Button lambda like this\n\n```kotlin\n@Composable\nfun VehicleUi(\n  car: Car,\n  bike: Bike,\n) {\n// ...\n\n    Column {\n        // ...\n\n        Button(\n            onClick = {\n                //...\n            }\n        ) {\n\n            // 🟠 Inside Button's content lambda\n            Rebugger(\n                trackMap = mapOf(\n                    \"car\" to car,\n                    \"bike\" to bike,\n                    \"human\" to human\n                ),\n            )\n            \n            // ...\n        }\n    }\n}\n```\n\nIt’ll print something like this\n\n![image](https://user-images.githubusercontent.com/9678279/229018052-97d66da3-c716-4553-a930-92ca740facc2.png)\n\n\n### The Fix\n\nTo fix this, you can pass composableName argument to override the automatic name picking behaviour\n\n```kotlin\nRebugger(\n    composableName = \"Button's body\",\n    trackMap = mapOf(\n        \"car\" to car,\n        \"bike\" to bike,\n        \"human\" to human\n    ),\n)\n```\n","funding_links":[],"categories":["Libraries","Kotlin"],"sub_categories":["🍎 Compose UI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheapache64%2Frebugger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheapache64%2Frebugger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheapache64%2Frebugger/lists"}