Solvedant design pro 🐛[BUG] Login doesn't work properly if /api/currentUser route is protected

🐛 Bug description

I protected route /api/currentUser. Its redirecting to Login page if its is not authenticated. This is a right behaviour but the problem is once after entering correct credential still its redirecting to the Login page. If you try to login twice it works.

📷 Recurring step

1.Protect /api/currentUser route

🏞 Desired result

Login should happen after entering proper credenctial.

💻 Complex modern code

Feels like following flags are not working properly... After login, loading flag shows as false always...

if ((!isLogin && loading) || !isReady) {
return ;
if (!isLogin) {
return <Redirect to={/user/login?${queryString}}>;

© Version Information

  • Ant Design Pro 4.0.0
  • linux
15 Answers

✔️Accepted Answer

I can also confirm that I've been hit by this. It's much simpler to reproduce also, if one follows the instructions here and without making any modifications, login to the /welcome page only works if credentials are entered twice.

The connect function in SecurityLayout.tsx is called twice with very different payloads, which is where I believe the problem lies, first time with parameters that seem to be coming from routing and the second time with parameters coming from the user state.

Other Answers:

Same Issue I am facing.
Without making any changes to the code , Even new bootstrap code itself having the same issue.

Related Issues:

ant design pro 🐛[BUG] Login doesn't work properly if /api/currentUser route is protected
I can also confirm that I've been hit by this It's much simpler to reproduce also ...
ngx admin No PostCSS Config found with build:prod
Or you can create a file named postcss.config.js in root directory Just leave it empty or write the ...
react admin Error: Invariant failed: You should not use <Route> outside a <Router>
Just remember: Before using {Route} from 'react-router-dom' library just make sure you put <Route> i...
EasyAdminBundle Multiple file/images upload - OneupUploaderBundle
I got this to work with VichUploaderBundle Is there any possibility to manage upload multiple files?...
react admin ra-data-graphql-simple shows error when plugged to apollo-server
I also encountered the issue and actually that's not a bug of React Admin but a React Hook misuse :)...
AdminLTE Active menu item with multi level submenus
nice script but it is not valid where you took the class ul.level-1 from? 😄 AdminLTE doesn't use so...
ngx admin Add JWT automatically for every HTTP request
FYI if you are using this solution check out my other reply: #1375 (comment) I couldn't get this to ...
react admin display array with arrayField or other
I cannot comprehend why this has been essentially wontfixed There is nothing at all strange about an...
CRUD [Feature] Ability to define any (nested) fields inside "table" field
I did something very similar to this implemented a field following the table field default and creat...
AdminLTE Sidebar menu treeview not working after redirection in Angular 4
This problem in Angular 6 and AdminLTE 3 was solved as follows: Note: I have a Sidebar component tha...
laravel filemanager Error when accessing /laravel-filemanager
In lfmhelpers.php line 335 replace the return with this: and in vendor/unisharp/laravel-filemanager/...
coreui free react admin template Deploy build to Nginx give error Uncaught SyntaxError: Unexpected token <
@thangnvse try this adding this into your nginx conf Step: npm run-script build Copy built files to ...
react admin Deprecated findDOMNode warning in StrictMode - originating from react-transition-group
Any timeline on this issue? We are using react-admin for an admin panel for our client and want to e...
CRUD How to customize search query?
:-)) hi @nathanielks Glad to hear the package gave was a nice surprise to you Well ...
CRUD Concatenate two columns in list view
Here's what you can do to make your attribute show when enableAjaxTable() is present on your CRUD: A...
AdminLTE How to remember the toggle state of the sidebar menu?
I've fixed the external Script with this is your 1 question answered :) i missed this on exporting i...
EasyAdminBundle Is there anything new to use translatable entities?
While preparing to upgrade to SF4 and Flex I had a go at this: Integrating KnpLabs/DoctrineBehaviors...
CRUD ReflectionException Class translator does not exist
It seems this has to do with calling trans() in config files which is apparently not possible in lar...
react admin Typescript declarations
Thanks I'll start writing types for next and post them in DefinitelyTyped Hi ...
react admin Pagination fails with *TypeError: onChangePage is not a function*
I think I found a workaround for the time being Using yarn in my package.json I added this resolutio...
react admin [RFC] Embedded Arrays using FieldArray
Nice! I think this could make it to the core But I'd prefer that subrecords are displayed as lines r...
CRUD Pagination using AJAX
Hi guys I've just finished AJAX pagination Is this considered? Right now all rows are queried ...
Serenity Sum of column in Detail Dialog - Shown/calculated immediately in a field of Parent Dialog
Here is a sample for you for OrderDialog constructor: Replace Q.notifySuccess with form.MyField.valu...
CRUD Bug image field, store in fake field (store as base64, not path)
Hi everyone Allow me to post this to this closed topic It could be useful to someone Looking for a s...
CRUD Laravel Backpack FIlter Not Called
Thx that solved the problem for me: Solution (working for Laravel >= 5.5) Configure App\Http\Middlew...
Serenity How to implement TreeView by SlickGrid in Serenity
It took me an hour to figure out how to turn default EntityGrid (generated by sergen) to a Tree List...
EasyAdminBundle After manual deleting cache got error
Hello Hours debugging helps figure out what's going on How to reproduce: Step 1 Install profiler ...
CRUD Upload field type on edit required issue
I know this is a closed issue but I found this after searching for a solution for a similar issue I ...
CRUD Return with Validator errors
Hi @OSDDQD This has happened to me before for custom CRUD entities when I applied the web middleware...
Serenity Back to use of AD credentials
@Solabar sorry I didn't get a chance to update this Some dudes here have resolved their issues and w...
Serenity [Please Comment] Inquiry about switching to TypeScript
Here is some update and proof of concept for TypeScript / Saltaralle interop: In ts-experiments bran...
ant design How to set 100% of height layout
This works for me: <Layout style={{height:100vh}}> I am a newbie I base on Meteor JS How to set 100%...
ant design Each record in table should have a unique key prop,or set rowKey to an unique primary key.
@ahmetkuslular The error message is pretty explicit your data set must contain items with a key prop...
ant design 😨 Table align broken when cell contains long number or long word after 3.11.3
超长连续字段(长数字和长单词) 破坏表格布局的问题(即使你指定了列的宽度也会被挤开),之前组件内默认加过 word-break: break-word; 去纠正此类布局,又会引起 #13624 的问题...
ant design Can't set form initialValues from state
I had the same problem sometimes the initialValues are empty and I need to fetch the initialValues f...
ant design CheckBox with Form was not work
I ran in to similar problem when i was trying to send form with selected checkbox because function v...
ant design import the antd theme, webpack build show .bezierEasingMixin error ?
version: antd@2.x less@2.x 是OK的。 less@3.x,需要开启 配置项 javascriptEnabled: true 但依然有错误: ...
ant design Check Box Validation not working
Following @yesmeck 's suggestion I came up with the following code which works as well ...
ant design Customization of theme is broken with latest version of less-loader
#23603 #23596 less-loader@5 less-loader@6 I have searched the issues of this repository and believe ...
ant design 引用国际化包报错
Change to fix this problem The resource provided by the document is wrong. I have searched the issue...
ant design Is there any way to disable all animations?
If anyone is wondering how to get rid of this clicked (glow fade-out) animation: Depending on the An...
ant design error TS2605 JSX element type Button is not a constructor function for JSX elements
Do you have allowSyntheticDefaultImports: true in tsconfig.json? Hello since this morning I am getti...
ant design Type error: Cannot find name 'ResizeObserver'.
The temporary fix is putting following interface to your typings/index.d.ts: I have searched the iss...
ant design Flash of unstyled content for first load
There is also a 'flash' of content reflow apparent on - have a...
ant design Select Custom dropdown with dropdownRender property not respond to click
Another perhaps more elegant I have searched the issues of this repository and believe that this is ...
ant design Impossible to expand Select component dropdown programatically
@martis347 Propably it's mousedown event now instead of click I have searched the issues of this rep...
ant design Errors when importing antd.less using less-loader
You mean less@3.0.0-alpha.3? Could you try less@2.7.2? Version antd @2.13.4 webpack @3.6.0 less @3.0...
ant design Typing issues with Typescript 3 and new LibraryManagedAttributes feature
For me the workaround is adding skipLibCheck: true to tsconfig.json
ant design Webpack css loading
This issue is resolved for me when i remove part of the recommended .babelrc config for ant-design B...