codesandbox / codesandbox/codesandbox-client

First load of CodeSanbox when logged in bug

Open
#6,032 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🐛 Bug UX
Dominant language
JavaScript
Stars
13.6k
Forks
2.4k
Avg merge
6d 19h
Merged PRs (30d)
2

Description

🐛 bug report

Description of the problem

I have a simple fetch in vanilla ts codesanbox, which loads some data from api and displays it on page.

//index.ts

async function fetchData(url: string) {
  const response = await fetch(url);
  return response.json();
}

fetchData("https://jsonplaceholder.typicode.com/todos").then((data) => {
  const app = document.getElementById("app");

  if (app)
    app.innerHTML = `
    <h1>Simple fetch example</h1><p><pre>${JSON.stringify(
      data,
      null,
      2
    )}</pre></p>`;
});

When I am logged in to my codesandbox account, on first load it doesn't work as expected.
It shows content for a moment and then clears it. If I'm not logged in, everything works as expected.

Issue #4128 might be related

To Reproduce

Try to copy/paste code provided above to codesandbox and test first load while logged in.

Your Environment
Software Name/Version
Сodesandbox ?? - version should be easy to find on sanbox
Browser Chrome Version 92.0.4515.131 (Official Build) (x86_64)
Operating System Mac OS Big Sur Version 11.2.3 (20D91)

Contributor guide

Open the contributing guide

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 provided index.ts vanilla TypeScript fetch example on the first load while logged in, then compare it with the logged-out behavior. Review issue #4128 for related context; done means the fetched page content remains visible on first load for logged-in users without breaking the logged-out case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.