Skip to content

FileBrowser doesn't follow conditional rendering #149

@lp9052

Description

@lp9052

Use Case:

Give a BASE_PATH, user can only go into subfolders/files, but not go up levels.

Try 1:

base_path, set_path = solar.use_state(BASE_PATH)

def setter(path):
    if some_condition:
         set_path(path)

FileBrowser(directory=base_path, on_directory_change=setter)

This won't work, since directory only controls starting point but is not used to control current folder

Try 2:

base_path, set_path = solar.use_state(BASE_PATH)
 
if BASE_PATH in base_path:
    FileBrowser(directory=base_path, on_directory_change =set_path)
else:
    FileBrowser(directory= BASE_PATH, on_directory_change =set_path)

This also will not work, since even the condition is triggered correctly, but the Filebrowser widget itself won't rerender.

Is there anyway to control what are the folders that users can/cannot get into?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions