Skip to content
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

In a LiveView, compact: true does not seem to work #100

Closed
Bastes opened this issue Oct 29, 2020 · 7 comments
Closed

In a LiveView, compact: true does not seem to work #100

Bastes opened this issue Oct 29, 2020 · 7 comments

Comments

@Bastes
Copy link
Contributor

Bastes commented Oct 29, 2020

Describe the bug
I'm using compact: true to avoid whitespaces in the .alert tags showing the flashes. The tags still get spaces inside in a liveview.

To Reproduce

# in a non-liveview template
p compact: true, do: nil
p compact: true, do: ""

# in a liveview template
p compact: true, do: nil
p compact: true, do: ""

In the non-liveview template, the paragraphs will have no whitespaces inside in the browser.
In a liveview template, the paragraphs will have two newline chars in the browser.

Expected behavior
All examples should keep no whitespace inside

Desktop (please complete the following information):

  • OS: Ubuntu 20:04 ; in a docker container (elixir:latest at the time of writing)
  • Temple Version: master branch (at the time of writing)
  • Elixir Version: 1.10.4
  • Erlang Version: Erlang/OTP 22 [erts-10.7.2.3]

Additional context
Reading the code, I don't believe this is a purely temple-centric problem ; it might be LiveView adding whitespaces while massaging the dom or something.

@mhanberg
Copy link
Owner

Can you try this with a normal leex template to see if you get the same behavior?

@Bastes
Copy link
Contributor Author

Bastes commented Oct 29, 2020

Good idea. Will do as soon as possible.

@Bastes
Copy link
Contributor Author

Bastes commented Oct 30, 2020

Tested in pure html .leex templates: the html shows no complementary whitespaces.

@mhanberg
Copy link
Owner

mhanberg commented Oct 30, 2020 via email

@Bastes
Copy link
Contributor Author

Bastes commented Oct 30, 2020

Sure, I'll be trying that ; I take it that will work with live_flash?

@mhanberg
Copy link
Owner

mhanberg commented Oct 30, 2020 via email

@Bastes
Copy link
Contributor Author

Bastes commented Oct 30, 2020

Hmm... I don't quite know what happened, but after removing the .leex templates I used to test that they did not add unnecessary spaces, it appears the compact: true attribute is now working as intended.

I'm completely puzzled as to why it did not do that yesterday, but maybe there was some cache keeping the previous templates (without the compact: true) in memory and now I've reloaded the server it doesn't have them? Anyways, I suggest we close this issue and sorry for the noise.

@Bastes Bastes closed this as completed Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants