Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve onMount lifecycle issue in iOS Safari by reordering layout structure #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0xSalik
Copy link
Contributor

@0xSalik 0xSalik commented Jan 27, 2025

Description

This PR fixes issue #268, where the onMount lifecycle hooks in child components (EditorTabs.svelte and its child Editor.svelte) were not being reliably triggered on iOS Safari. The issue was caused by the main application layout <div> being nested within a conditional isLoading block, which affected how iOS Safari handled the rendering and mounting of child components.

To address this, the main application layout <div> containing the <EditorTabs /> and <MenuBar /> has been moved outside of the isLoading condition. This ensures that child components are always mounted, regardless of the loading state, allowing their lifecycle hooks to trigger as expected.

Changes

  • Moved the <div> containing the main layout (<MenuBar /> and <EditorTabs />) out of the isLoading conditional block.
  • Preserved the loading behavior by keeping the <Loading /> component conditional.

Testing

  • Browsers Tested:

    • Windows 11: Chrome, Firefox, Edge
    • iOS: Safari (Issue confirmed resolved)
  • Behavior Verified:

    • Confirmed onMount triggers as expected for all child components across all platforms.
    • Verified no regressions in the isLoading behavior.

Fixes

Fixes #268: Problems on iOS devices
and #267: Keyboard does not appear in notpad text area on iOS devices

…ucture

- Moved the main layout `<div>` containing `<MenuBar />` and `<EditorTabs />` outside the `isLoading` conditional block in `App.svelte`
- Prevents issues with child components' `onMount` lifecycle hooks not firing on iOS Safari
- Fixes issue Muhammed-Rahif#268: `onMount` not triggering for child components on iOS Safari
Copy link

vercel bot commented Jan 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
notpad ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 27, 2025 10:58am

@Muhammed-Rahif Muhammed-Rahif added the awaiting-review An issue or pull request that needs to be reviewed label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review An issue or pull request that needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems on iOS devices
2 participants