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

feat(compiler-core): support Error in template #7018

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Conversation

posva
Copy link
Member

@posva posva commented Nov 3, 2022

Related to #7015

@m0ksem
Copy link

m0ksem commented Nov 3, 2022

In case there will be Error global, shouldn't we also be able to use console in template context?

This might be more helpful than Error in debugging.

 <template>
  <va-tree-view :nodes="nodes">
    <template #content="node">
      {{ console.log(node) }}
    </template>
  </va-tree-view>
</template> 

@posva
Copy link
Member Author

posva commented Nov 3, 2022

console was requested in the past but it was decided not to be added. I can’t find the issue now. Maybe it was in vue repo and not in core?

Copy link
Member

@znck znck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the linked issue and still I don't understand the use-case for this. We cannot throw errors in template as throw new Error() is a statement and we cannot use statements in template (except for v-on).

@posva posva added need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further. scope: compiler labels Nov 3, 2022
@posva
Copy link
Member Author

posva commented Nov 3, 2022

The only use case would be passing Error() as a parameter but then we would also have to support the Promise global (@znck said offline)

Whatever direction this take, at least we will have a reference issue for future feature requests

@sxzz
Copy link
Member

sxzz commented Oct 20, 2023

Related #9069

@sxzz sxzz removed the need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further. label Oct 20, 2023
@sxzz sxzz changed the title feat(compiler): add support for Error global feat(compiler-core): support Error in template Oct 20, 2023
@sxzz sxzz added ready to merge The PR is ready to be merged. easy to merge labels Oct 20, 2023
@github-actions
Copy link

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 85.9 kB (+6 B) 32.7 kB (+4 B) 29.5 kB (+22 B)
vue.global.prod.js 132 kB (+6 B) 49.4 kB (+3 B) 44.3 kB (+8 B)

Usages

Name Size Gzip Brotli
createApp 47.9 kB 18.8 kB 17.2 kB
createSSRApp 50.6 kB 20 kB 18.2 kB
defineCustomElement 50.3 kB 19.6 kB 17.9 kB
overall 61.2 kB 23.7 kB 21.6 kB

@skirtles-code
Copy link
Contributor

@posva It looks like this PR has been mangled by changes elsewhere. The file globalsWhitelist.ts has been renamed to globalAllowList.ts, which is likely why the unit test is failing on the CI.

@posva posva force-pushed the feat/globals-error branch 2 times, most recently from cca5113 to d14821a Compare October 26, 2023 19:21
@posva
Copy link
Member Author

posva commented Oct 26, 2023

@skirtles-code It should be good now!

@yyx990803 yyx990803 merged commit bcca475 into minor Nov 30, 2023
6 checks passed
@yyx990803 yyx990803 deleted the feat/globals-error branch November 30, 2023 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants