-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shared Content not loading properly #166
Comments
@wedgberto can you provide a demo video? |
It's more difficult than you'd think to screen capture it actually. The use of # in the URL makes it fiddly to convince web browsers to refresh the page (but that's a different issue). This gif has the three frames showing the flashing in and out of the shared info slowed down for visibility. |
A quick clone and build indicates that the loading of the model kind state is what is causing this. React useState is async and it seems that setting the model kind here https://github.com/casbin/casbin-editor/blob/6f34b11b3cef82a127424cf931429d85e8ff8cbd/app/components/editor/hooks/useIndex.tsx#L57C11-L61C12 is the last state update to complete and apparently clobbers the state updates of the loaded shared info. I hacked a fix to kind of prove this by deferring the setting of the model/policy/request shared content in a SetTimeout, so am pretty sure it's just the order of completion of these async operations. |
I'm new to React so not sure my fix is the best, but I've created PR #167 |
🎉 This issue has been resolved in version 1.24.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
When navigating to a URL generated by the Casbin editor Share button, the content loads for a split second and then reverts to the default for the Model that the config was based on.
My example was based on "RBAC with domains/tenants", and the default for this Model is what I am left viewing after navigating to the shared URL, despite the shared values frustratingly flickering into view for a split second.
When not changing the base Model i.e. ACL the share URL works - https://editor.casbin.org/#58SA4DACF
When changing the base Model e.g. "RBAC with domains/tenants" the default for that Model is what ends up displayed - https://editor.casbin.org/#562HX9RD8 (policy and request items should all begin with x, but do not. e.g. xalice, xdomain1, xdata1, xread)
The text was updated successfully, but these errors were encountered: