mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-01 17:10:24 +08:00
When ACCESS_CODE_LIST is configured on the server, the settings dialog was not showing the access code input field in two cases: 1. Stale localStorage cache: if a user had previously visited without ACCESS_CODE_LIST enabled, the cached value of accessCodeRequired=false would be used indefinitely, hiding the password input. 2. Race condition on first visit: the dialog could open triggered by an auth error before the async fetch to /api/config completed, showing a blank settings dialog with no access code field. Fix by re-fetching /api/config whenever the dialog opens (on open change) instead of only once on mount with a cache guard. The cached value in localStorage is still updated on success, keeping the fast initial render intact while ensuring the dialog always reflects the server configuration. Fixes #811 Co-authored-by: octo-patch <octo-patch@github.com>