René's URL Explorer Experiment


Title: List View null ref on cell reuse · Issue #10000 · NativeScript/NativeScript · GitHub

Open Graph Title: List View null ref on cell reuse · Issue #10000 · NativeScript/NativeScript

X Title: List View null ref on cell reuse · Issue #10000 · NativeScript/NativeScript

Description: Issue Description When adding multiple items to a list view at runtime, on iOS only, we get a crash: Nativescript encountered a fatal error: Uncaught TypeError: cannot read property 'removeFromSuperview' of null at _prepareCell(file: ......

Open Graph Description: Issue Description When adding multiple items to a list view at runtime, on iOS only, we get a crash: Nativescript encountered a fatal error: Uncaught TypeError: cannot read property 'removeFromSupe...

X Description: Issue Description When adding multiple items to a list view at runtime, on iOS only, we get a crash: Nativescript encountered a fatal error: Uncaught TypeError: cannot read property 'removeFrom...

Opengraph URL: https://github.com/NativeScript/NativeScript/issues/10000

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"List View null ref on cell reuse","articleBody":"### Issue Description\n\nWhen adding multiple items to a list view at runtime, on iOS only, we get a crash:\r\n```\r\nNativescript encountered a fatal error: Uncaught TypeError: cannot read property 'removeFromSuperview' of null at _prepareCell(file: ...core/ui/list-view/index.ios.js\r\n```\r\n\r\nInvestigating further it was determined that the culprit is the code in `list-view/index.ios.ts::_prepareCell()`:\r\n\r\n```ts\r\n          this._removeContainer(cell);\r\n          (\u003cUIView\u003ecell.view.nativeViewProtected).removeFromSuperview();          \r\n```\r\n\r\nThe remove container method makes a call to\r\n\r\n```ts\r\n view.parent._removeView(view);\r\n```\r\nwhich sets the cell's `nativeViewProtected` to null as part of the parent's tear down, causing the removeFromSuperview() call to fail.\r\n\r\nThe easy workaround/fix is to make the remove call null safe eg \r\n\r\n```ts\r\n(\u003cUIView\u003e cell.view?.nativeViewProtected)?.removeFromSuperview()\r\n```\r\n\r\n\n\n### Reproduction\n\nhttps://stackblitz.com/edit/nativescript-stackblitz-templates-xtpbxb?file=app/components/Home.svelte\r\n\r\nor inline\r\n\r\n```svelte\r\n\u003cpage\u003e\r\n        \u003cactionBar title=\"My Tasks\" /\u003e\r\n        \u003ctabView\u003e\r\n            \u003ctabViewItem title=\"To Do\"\u003e\r\n                \u003cgridLayout columns=\"*,120\" rows=\"70,*\"\u003e\r\n                    \u003c!-- Configures the text field and ensures that pressing Return on the keyboard\r\n                            produces the same result as tapping the button. --\u003e\r\n                    \u003ctextField col=\"0\" row=\"0\" bind:text=\"{textFieldValue}\" hint=\"Type new task...\" editable=\"true\"\r\n                            on:returnPress=\"{onButtonTap}\" /\u003e\r\n                    \u003cbutton col=\"1\" row=\"0\" text=\"Add task\" on:tap=\"{onButtonTap}\" /\u003e\r\n\r\n                    \u003clistView items=\"{todos}\" on:itemTap=\"{onItemTap}\" row=\"1\" colSpan=\"2\"\u003e\r\n                            \u003cTemplate let:item\u003e\r\n                                    \u003clabel text=\"{item.name}\" textWrap=\"true\" /\u003e\r\n                            \u003c/Template\u003e\r\n                    \u003c/listView\u003e\r\n                \u003c/gridLayout\u003e\r\n            \u003c/tabViewItem\u003e\r\n            \u003ctabViewItem title=\"Completed\"\u003e\r\n                    \u003clabel textWrap=\"true\"\u003eThis tab will list completed tasks for tracking.\u003c/label\u003e\r\n            \u003c/tabViewItem\u003e\r\n        \u003c/tabView\u003e\r\n\u003c/page\u003e\r\n\r\n\u003cscript\u003e\r\n\t\timport { Template } from 'svelte-native/components'\r\n\r\n\t\tlet todos = []\r\n\t\tlet textFieldValue = \"\"\r\n\r\n\t\tfunction onItemTap(args) {\r\n\t\t\t\tconsole.log(`Item ${todos[args.index].name} at index: ${args.index} was tapped`);\r\n\t\t}\r\n\r\n\t\tfunction onButtonTap() {\r\n\t\t\tif (textFieldValue === \"\") return; // Prevents users from entering an empty string.\r\n\t\t\tconsole.log(\"New task added: \" + textFieldValue + \".\"); // Logs the newly added task in the console for debugging.\r\n\t\t\ttodos = [{ name: textFieldValue }, ...todos] // Adds tasks in the ToDo array. Newly added tasks are immediately shown on the screen.\r\n\t\t\ttextFieldValue = \"\"; // Clears the text field so that users can start adding new tasks immediately.\r\n\t\t}\r\n\u003c/script\u003e\r\n```\r\n\r\nAdd a second/third item to the todolist and it should crash\n\n### Relevant log output (if applicable)\n\n_No response_\n\n### Environment\n\n(on another machine)\r\nNativescript Core 8.3.2\r\nPlatform iOS 13.4.1\n\n### Please accept these terms\n\n- [X] I have searched the [existing issues](https://github.com/NativeScript/NativeScript/issues) as well as [StackOverflow](https://stackoverflow.com/questions/tagged/nativescript) and this has not been posted before\n- [X] This is a bug report\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc)","author":{"url":"https://github.com/halfnelson","@type":"Person","name":"halfnelson"},"datePublished":"2022-08-20T01:25:35.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/10000/NativeScript/issues/10000"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8bd01bbe-f326-d554-6b33-1dc646a9ec7c
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAE94:19DD7D:209A84D:21EB8D3:6A5C8F4F
html-safe-noncebd48ab3ea7b5c861ab243d9e0f97b28ac455e7930c18ff1f9a249dc503f4b4d2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTk0OjE5REQ3RDoyMDlBODREOjIxRUI4RDM6NkE1QzhGNEYiLCJ2aXNpdG9yX2lkIjoiMTEwMDI3ODU1MTgwNTcyNjU0MyIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9
visitor-hmac33edc554974950386f2753ad72b11b33c4342068c7202be09cb0ffc61f569a24
hovercard-subject-tagissue:1345016165
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/10000/issue_layout
twitter:imagehttps://opengraph.githubassets.com/6c463fdfa0f02962b61b957fc35772ae4d78537cf12af0b78b7291bfc272c070/NativeScript/NativeScript/issues/10000
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/6c463fdfa0f02962b61b957fc35772ae4d78537cf12af0b78b7291bfc272c070/NativeScript/NativeScript/issues/10000
og:image:altIssue Description When adding multiple items to a list view at runtime, on iOS only, we get a crash: Nativescript encountered a fatal error: Uncaught TypeError: cannot read property 'removeFromSupe...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehalfnelson
hostnamegithub.com
expected-hostnamegithub.com
None5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b
turbo-cache-controlno-preview
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c975978430e9ad293956f2bbdaf153b1bd84a99
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/issues/10000#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F10000
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fissues%2F10000
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/issues/10000
Reloadhttps://github.com/NativeScript/NativeScript/issues/10000
Reloadhttps://github.com/NativeScript/NativeScript/issues/10000
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/10000
NativeScript https://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Please reload this pagehttps://github.com/NativeScript/NativeScript/issues/10000
Notifications https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Fork 1.7k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Star 25.6k https://github.com/login?return_to=%2FNativeScript%2FNativeScript
Code https://github.com/NativeScript/NativeScript
Issues 771 https://github.com/NativeScript/NativeScript/issues
Pull requests 67 https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security and quality 0 https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
Code https://github.com/NativeScript/NativeScript
Issues https://github.com/NativeScript/NativeScript/issues
Pull requests https://github.com/NativeScript/NativeScript/pulls
Discussions https://github.com/NativeScript/NativeScript/discussions
Actions https://github.com/NativeScript/NativeScript/actions
Projects https://github.com/NativeScript/NativeScript/projects
Wiki https://github.com/NativeScript/NativeScript/wiki
Security and quality https://github.com/NativeScript/NativeScript/security
Insights https://github.com/NativeScript/NativeScript/pulse
#10001https://github.com/NativeScript/NativeScript/pull/10001
List View null ref on cell reusehttps://github.com/NativeScript/NativeScript/issues/10000#top
#10001https://github.com/NativeScript/NativeScript/pull/10001
https://github.com/NathanWalker
bughttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22bug%22
ready for testTSC needs to test this and confirm against live production apps and automated test suiteshttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22ready%20for%20test%22
https://github.com/halfnelson
halfnelsonhttps://github.com/halfnelson
on Aug 20, 2022https://github.com/NativeScript/NativeScript/issues/10000#issue-1345016165
https://stackblitz.com/edit/nativescript-stackblitz-templates-xtpbxb?file=app/components/Home.sveltehttps://stackblitz.com/edit/nativescript-stackblitz-templates-xtpbxb?file=app/components/Home.svelte
existing issueshttps://github.com/NativeScript/NativeScript/issues
StackOverflowhttps://stackoverflow.com/questions/tagged/nativescript
Code of Conducthttps://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#coc
NathanWalkerhttps://github.com/NathanWalker
bughttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22bug%22
ready for testTSC needs to test this and confirm against live production apps and automated test suiteshttps://github.com/NativeScript/NativeScript/issues?q=state%3Aopen%20label%3A%22ready%20for%20test%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.