-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
define:vars not working in Safari #5064
Comments
@aleksa-codes @matthewp something is making <script> as <script>{ when being added as a HTML Parts before render takes place. Not able to find the place where this extra curly brace could've been added. |
@aleksa-codes I think it's more of a astro/compiler issue to detect? Those extra curly braces after the tag 👀 |
+1 ... curly braces @matthewp is there any chance a fix for this critical problem will be in the next release of Astro? |
@matthewp and @natemoo-re - all these problems in Safari are probably caused by changes in this PR #3976 I understand that Unless there is a better solution for this situation, I suggest that the addition of At the same time, I think that if someone decides to use |
Why do we need those {} at all?
Reassigning won't be possible as the variable are defined with const (as
let fails with safari scoping methods)
…On Wed, Oct 26, 2022, 03:46 Ján Regeš ***@***.***> wrote:
@matthewp <https://github.com/matthewp> and @natemoo-re
<https://github.com/natemoo-re> - all these problems in Safari are
probably caused by changes in this PR #3976
<#3976>
I understand that {} are used to avoid redeclaration errors (which can be
encountered by some use-cases), but unfortunately it causes fatal problems
in Safari.
Unless there is a better solution for this situation, I suggest that the
addition of {} be controlled by some configuration parameter. What do you
think about it?
At the same time, I think that if someone decides to use define:vars in a
repeatedly inserted component, they should ensure that these global
variables have unique names. Typically containing e.g. entity ID, so e.g.
```<script define:vars={{name_${componentId}: $name}}`> ... </script>``
—
Reply to this email directly, view it on GitHub
<#5064 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALBHXORHFYXGTR4BEJKWJELWFBL3RANCNFSM6AAAAAARD7OUW4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@rishi-raj-jain - it was a good intention from @natemoo-re and it solves a situation where a component with In my opinion, the addition of At the same time, I would expect this behavior to be implemented in the
I was debugging this last night and it was very confusing to me that the logic isn't just inside the method. |
Hi folks, are there any workarounds in the meantime? I can rewrite component with React, etc but that is truly an awful situation to be in. Safari is not a niche browser, so this feels like an incredibly important issue to address. |
@janreges do you know the reason why the |
Pretty sure it's this bug: https://bugs.webkit.org/show_bug.cgi?id=179698 |
Got a fix in the works. |
Fix is in withastro/compiler#599 |
What version of
astro
are you using?1.4.6
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
yarn
What operating system are you using?
Mac, iOS
Describe the Bug
The issue was closed but the problem is still there: #4859
Check my footer in Safari on Mac/iOS for a reproduction of the problem.
code: https://github.com/aleksa-codes/astro-portfolio/blob/main/src/components/Footer.astro
Link to Minimal Reproducible Example
https://aleksa.codes
Participation
The text was updated successfully, but these errors were encountered: