Stop registering view paths the bundle never ships - #346
Merged
shanerbaner82 merged 5 commits intoAug 24, 2026
Merged
Conversation
…scaffolded components
gwleuverink
marked this pull request as ready for review
August 16, 2026 22:19
shanerbaner82
approved these changes
Aug 24, 2026
shanerbaner82
left a comment
Contributor
There was a problem hiding this comment.
Looks good. view:cache crash on missing package view paths is real, and dropping the unused hasViews()/jump:: registrations is the right fix instead of shipping empty dirs forever. Shipping empty resources/views/native covers apps that never ran native:make-component. Tests lock both shapes. Jump still reads those blades off disk, so the namespace drop is safe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #322.
Every debug boot runs
view:cacheon the device, and it walks every registered view path with a Symfony Finder that throws when a path is missing. Two of the provider's registrations point at directories no bundle ever contains, because all three packers stripvendor/nativephp/mobile/resources(11MB of project templates the runtime never reads). So every cold boot logs this and dies:The two registrations are
->hasViews()and thejumpnamespace. Neither serves a purpose at runtime.hasViews()registers the package rootresources/views, which contains a single.gitkeep, and its publish tag (nativephp-mobile-views) is never published bynative:install. As far as I can tell it's scaffolding from the Spatie package skeleton: the.gitkeep-only views dir and the provider call both match the template, unchanged since the Init commit. The empty dir is deleted here as well. The real component views went tosrc/resources/viewsinstead, under a separate registration that ships fine and stays. Thejump::namespace has zeroview()references anywhere, the jump server reads those blades as raw text withfile_get_contentson the host.I checked whether anything contributes files into those two directories in a userland project before deleting the registrations. Nothing does: my test project symlinks the package into vendor, so any runtime write would show up in git status, and after many install, plugin-register and build cycles the tree is clean. mobile-ui registers no view namespace and every plugin write path resolves into the native build tree.
I actually went the other way first, shipping the two dirs as empty entries from every packer. It worked, but it put the burden on three different packers forever, and once it was clear the registrations are unused skeleton there was nothing left to ship around. Two deleted lines in the provider instead.
While hardening the regression test I found a third leg of the same crash: the provider also registers
resources/views/nativeas a view location for every app, and onlynative:make-componentever creates that dir. An app that never scaffolded a native component hits the sameview:cachecrash, afterview:clearhas already run, so it's left with no compiled views at all. That location is genuinely wanted (it's where an app's own native views live), so this leg is fixed the way the issue originally suggested:resources/views/nativejoinsBundleExclusions::REQUIRED_DIRECTORIESand ships as an empty entry, which every packer already honors.The provider has a comment documenting a deliberate choice to register view paths unconditionally so IDE plugins that scan providers statically can index them. That argument holds for
resources/views/nativeand thesrc/resources/viewsnamespace, both of which stay exactly as they are, but an IDE gains nothing from indexing a.gitkeepor a namespace no code references. If I'm missing a reason either registration needs to stay, @simonhamp @shanerbaner82, happy to hear it.Verification
src/../resources/viewsstring when the dir is missing andrealpath()-based checks go blind on it. Proven red for both regression shapes: re-addinghasViews()and re-adding the jump registration.nativephp-mobile::components.native-element-with-childrenstaying resolvable, since it rides the registration that stays. The release bundle test additionally assertsresources/views/native/ships.view:cacheon the host exits clean.vendor/nativephp/mobile/resourcesentries, logcat showsview:cacherunning post-extraction and producing 66 compiled views, and theDirectoryNotFoundExceptioncount in the persisted log stayed frozen at the 5 pre-fix entries. The app renders normally.resources/views/nativedeleted from its source. The bundle ships it as an empty entry, the dir lands on device,view:cacheruns clean, and the exception count stays frozen. That exact build crashed on every boot before this change.app.zipcontains no vendor resources entries, shipsresources/views/native/, and the app boots and renders.native:jumpagainst the branch: the QR page renders and serves normally, since the jump server reads its blades directly off disk and never used the removed namespace.