Issue Type
Description
At the moment I am using Mirage.js to simulate real API behavior for the application. When I add the route (/api/movies
) to the server.ts
file and start the server, the application doesn't fetch the required API data. However, when I add strict mode to the main.tsx
file, the API starts to work. Upon opening the console, I encounter an error: 'You created a second Pretender instance while there was already one running'. This issue arises because React strict mode runs the code twice, resulting in the creation of two server instances. If I remove strict mode, the application doesn't make any request to the API.
Steps to Reproduce
If you're reporting a bug, provide detailed steps to reproduce the issue.
- Open the application.
- Navigate to the "/dashboard".
- Open the console.
Current Behavior
Getting error from React saying: "Running two Pretender servers at once will lead to unexpected results and will be removed entirely in a future major version". Also getting axios error which says 404 when requesting data from http://localhost:5173/api/movies
.
Expected Behavior
With/Without Strict mode, I should be getting all the results from the API at initial render without getting any axios or instances error.
Screenshots
![Screenshot (753)](https://private-user-images.githubusercontent.com/122507740/260537179-7bbfb3bf-7b8a-4428-ae4f-2a9dcee2ed7f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxNzg1NjQsIm5iZiI6MTcyNDE3ODI2NCwicGF0aCI6Ii8xMjI1MDc3NDAvMjYwNTM3MTc5LTdiYmZiM2JmLTdiOGEtNDQyOC1hZTRmLTJhOWRjZWUyZWQ3Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODIwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgyMFQxODI0MjRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MGRmYTVhOGJjZDUxNjQ3YTdlOWRmZTVjYTYzMTllMjM5OGFiZGUxNWM2ZWEzMDgwM2QxMzc2Y2MxYWZmZjBhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.XoQ-i5jd8ugWRHjSHdiV7zy9-_qXVieeai_1y4bFE8I)
Additional Context
I'm using the application on Firefox 116.0.2.
Possible Solution
It is possible that I am facing this issue because of the way I've set up Mirage.js in the Codebase.
Related Issues
None
Checklist
Adjust the checklist items as needed.