reflex icon indicating copy to clipboard operation
reflex copied to clipboard

rx._x.asset improvements

Open benedikt-bartscher opened this issue 1 year ago β€’ 1 comments

Closes #3623

benedikt-bartscher avatar Jul 04 '24 18:07 benedikt-bartscher

@benedikt-bartscher I've had a look at the changes and slept one night on it :) We have two different use cases that both deal with the asset folder:

  • The file an URL is created for is already in the asset folder. In this case the function prepends the path with "/assets/" and the presence of the file is checked.
  • The external asset use case where the file is located relative to the including .py file and copied only when not ENV_BACKEND_ONLY and the resulting file is returned as link.

On my option the automatic detection can be removed and then immediately raise an exception when shared=True, but the file is not located relative to the caller. A file name collision is very unlikely especially because assets/external is on .gitignore Otherwise I think the implementation is cool.

One question: Is it wanted, that missing file presence of local assets should raise when ENV_BACKEND_ONLY? I thought that might be the case where no assets folder is present at all?

abulvenz avatar Jul 05 '24 09:07 abulvenz

Marked this as draft until re-synced with main.

Lendemor avatar Oct 25 '24 18:10 Lendemor

@masenf that's awesome, thank you very much. I will rebase our fork and report if everything still works

benedikt-bartscher avatar Nov 18 '24 21:11 benedikt-bartscher