question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React 18 strict mode breaks URL query params

See original GitHub issue

What you were expecting:

That react admin works normally with React 18 strict mode

What happened instead:

When I click on a column header to sort the url doesn’t update with query params, so nothing happens.

Steps to reproduce:

In the code sandbox try to sort a column, see it doesn’t work. In index.js, comment out the React 18 section and uncomment the React 17 mode section, sorting should work now.

Related code:

https://codesandbox.io/s/sweet-fast-1pkgk5?file=/src/index.js

React 18 mode (broken):

import App from "./App";
import * as React from "react";
import { StrictMode } from "react";
import * as ReactDOMClient from "react-dom/client";

const rootElement = document.getElementById("root");
const root = ReactDOMClient.createRoot(rootElement);

root.render(
  <StrictMode>
    <App />
  </StrictMode>
);

React 17 mode (working):

import App from "./App";
import * as React from "react";
import { render } from "react-dom";
const container = document.getElementById("root");
render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  container
);

Environment

  • React-admin version: 4
  • React version: 18
  • Browser: Latest Chrome and Safari

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
fzaninottocommented, Apr 11, 2022

Yes, closing.

0reactions
WiXSLcommented, Apr 11, 2022

Can this one be closed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Update Query Params in React - MakeUseOf
Using React Router to Update Query Parameters ... enters a query into a search bar, you should store that query in the URL....
Read more >
Concurrent UI Patterns (Experimental) - React
React 18 was released with support for concurrency. However, there is no “mode” anymore, and the new behavior is fully opt-in and only...
Read more >
How to get parameter value from query string? - Stack Overflow
React Router v4 · 1.use regular expression to get query string. · 2.you can use the browser api. image the current url is...
Read more >
Using strict mode in React 18: A guide to its new behaviors
Introduction to React's strict mode; Warnings on the use of unsafe lifecycle methods; Recommending the createRef API over the legacy string ...
Read more >
decodeURIComponent() - JavaScript - MDN Web Docs - Mozilla
A new string representing the decoded version of the given encoded Uniform ... Decoding query parameters from a URL ... Chrome Android18.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found