Shopify / Shopify/react-native-skia

React Native Skia on Web - Unable to load with multiple tabs open at once

Open
#3,505 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.6k
Forks
647
Avg merge
1d 17h
Merged PRs (30d)
35

Description

Description

Using WithSkiaWeb, having more then one tab opened at once, fallback attribute will trigger

I've also checked that canvaskit.wasm is correctly fetching in duplicated tab, so I guess it's just issue with WithSkiaWeb

React Native Skia Version

2.2.12

React Native Version

0.81.4

Using New Architecture
  • Enabled
Steps to Reproduce
  1. Use WithSkiaWeb
import '@expo/metro-runtime'
import { WithSkiaWeb } from '@shopify/react-native-skia/lib/module/web';
import { fontsConfig } from './fontsConfig';
import { useFonts } from 'expo-font';
import UILoaderText from './components/UI/UILoaderText';


export default function App() {

  let location = window.location.origin

  /* -------------------------- 2. Load Project Font -------------------------- */
  const [fontsLoaded] = useFonts(fontsConfig);
  if (!fontsLoaded) return <UILoaderText text='Fonts' />;
  /* -------------------------------------------------------------------------- */


  return (
    <WithSkiaWeb
      getComponent={() => import("./AppCore")}
      opts={{
        locateFile: (file) => `${location}/${file}?v=${Date.now()}`
      }}
      fallback={<UILoaderText text='Loading skia web...' />}
    />
  );
}
  1. Duplicate Tab in browser
  2. Unable to pass Loading skia web
Snack, Code Example, Screenshot, or Link to Repository
import '@expo/metro-runtime'
import { WithSkiaWeb } from '@shopify/react-native-skia/lib/module/web';
import { fontsConfig } from './fontsConfig';
import { useFonts } from 'expo-font';
import UILoaderText from './components/UI/UILoaderText';


export default function App() {

  let location = window.location.origin

  /* -------------------------- 2. Load Project Font -------------------------- */
  const [fontsLoaded] = useFonts(fontsConfig);
  if (!fontsLoaded) return <UILoaderText text='Fonts' />;
  /* -------------------------------------------------------------------------- */


  return (
    <WithSkiaWeb
      getComponent={() => import("./AppCore")}
      opts={{
        locateFile: (file) => `${location}/${file}?v=${Date.now()}`
      }}
      fallback={<UILoaderText text='Loading skia web...' />}
    />
  );
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided WithSkiaWeb example, opening the app in two browser tabs and checking the fallback state. Trace the web loading path used by WithSkiaWeb and compare the behavior between one and multiple tabs; done means both tabs load the component instead of remaining on the fallback.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.