Skip to content

Commit 6853f6a

Browse files
kherembourgclaude
andcommitted
fix(ios): cleanup and error handling improvements from code review
- Remove no-op willMove(toParent:)/removeFromParent() calls in setupView() since _controller is never added as a child VC; only view cleanup needed - Log unexpected onPresentationClosed errors in PLYPresentationView instead of silently swallowing them (cancellation errors remain suppressed) - Remove debug console.log from Home.tsx example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7235d2d commit 6853f6a

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

example/src/Home.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export const HomeScreen: React.FC<NativeStackScreenProps<any>> = ({
3131
})
3232
.then((p) => {
3333
cachedPresentation.current = p
34-
console.log('### Home: presentation fetched and cached', p.id)
3534
})
3635
.catch(console.error)
3736
}, [])

packages/purchasely/ios/PurchaselyView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class PurchaselyView: UIView {
4040
private func setupView() {
4141
// Clean up previous view/controller before setting up new ones
4242
_view?.removeFromSuperview()
43-
_controller?.willMove(toParent: nil)
44-
_controller?.removeFromParent()
4543
_view = nil
4644
_controller = nil
4745

packages/purchasely/src/components/PLYPresentationView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ export const PLYPresentationView: React.FC<PLYPresentationViewProps> = ({
3636
if (!cancelled) {
3737
onPresentationClosed(result);
3838
}
39-
} catch (_) {
40-
// Ignore errors when the effect is cancelled (component unmounted or prop changed)
39+
} catch (e) {
40+
// Only log unexpected errors — ignore if the effect was cancelled
41+
if (!cancelled) {
42+
console.warn('[PLYPresentationView] onPresentationClosed error:', e)
43+
}
4144
}
4245
};
4346

0 commit comments

Comments
 (0)