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...

/.../src/layouts/SecurityLayout.tsx
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 https://pro.ant.design/docs/getting-started 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:

4
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 ...
288
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 ...
66
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...
59
EasyAdminBundle Multiple file/images upload - OneupUploaderBundle
I got this to work with VichUploaderBundle Is there any possibility to manage upload multiple files?...
58
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 :)...
44
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...
39
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 ...
34
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...
29
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...
28
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...
27
laravel filemanager Error when accessing /laravel-filemanager
In lfmhelpers.php line 335 replace the return with this: and in vendor/unisharp/laravel-filemanager/...
25
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 ...
24
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...
16
CRUD How to customize search query?
:-)) hi @nathanielks Glad to hear the package gave was a nice surprise to you Well ...
14
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...
13
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...
12
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...
12
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...
12
react admin Typescript declarations
Thanks I'll start writing types for next and post them in DefinitelyTyped Hi ...
12
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...
11
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...
7
CRUD Pagination using AJAX
Hi guys I've just finished AJAX pagination Is this considered? Right now all rows are queried ...
5
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...
4
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...
4
CRUD Laravel Backpack FIlter Not Called
Thx that solved the problem for me: Solution (working for Laravel >= 5.5) Configure App\Http\Middlew...
4
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...
3
EasyAdminBundle After manual deleting cache got error
Hello Hours debugging helps figure out what's going on How to reproduce: Step 1 Install profiler ...
3
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 ...
3
CRUD Return with Validator errors
Hi @OSDDQD This has happened to me before for custom CRUD entities when I applied the web middleware...
3
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...
3
Serenity [Please Comment] Inquiry about switching to TypeScript
Here is some update and proof of concept for TypeScript / Saltaralle interop: In ts-experiments bran...
431
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%...
413
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...
153
ant design 😨 Table align broken when cell contains long number or long word after 3.11.3
超长连续字段(长数字和长单词) 破坏表格布局的问题(即使你指定了列的宽度也会被挤开),之前组件内默认加过 word-break: break-word; 去纠正此类布局,又会引起 #13624 的问题...
119
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...
113
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...
93
ant design import the antd theme, webpack build show .bezierEasingMixin error ?
version: antd@2.x less@2.x 是OK的。 less@3.x,需要开启 配置项 javascriptEnabled: true 但依然有错误: ...
81
ant design Check Box Validation not working
Following @yesmeck 's suggestion I came up with the following code which works as well ...
78
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 ...
59
ant design 引用国际化包报错
Change to fix this problem The resource provided by the document is wrong. I have searched the issue...
58
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...
38
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...
29
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...
27
ant design Flash of unstyled content for first load
There is also a 'flash' of content reflow apparent on https://ant.design/components/layout/ - have a...
23
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 ...
22
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...
22
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...
19
ant design Typing issues with Typescript 3 and new LibraryManagedAttributes feature
For me the workaround is adding skipLibCheck: true to tsconfig.json https://stackoverflow.com/a/5240...
18
ant design Webpack css loading
This issue is resolved for me when i remove part of the recommended .babelrc config for ant-design B...