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

fix(nuxt): get fallback for <DevOnly> from parsed html #20840

Merged
merged 3 commits into from May 15, 2023

Conversation

ineshbose
Copy link
Member

@ineshbose ineshbose commented May 14, 2023

πŸ”— Linked issue

#20817 (comment)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

It should now allow the documented example as well:

    <DevOnly>
      <!-- arrows before fallback or... -->
       <ClientOnly>
          <template #fallback>
            <div>test</div>
          </template>
      </ClientOnly>
      <template #fallback>
        <div></div>
      </template>
    </DevOnly>

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@nuxt-studio
Copy link

nuxt-studio bot commented May 14, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview bca1590

@ineshbose ineshbose changed the title fix(dev-only): split regex to allow < character fix(dev-only-fallback): split regex to allow < character May 14, 2023
@ineshbose ineshbose closed this May 14, 2023
@ineshbose ineshbose reopened this May 14, 2023
@ineshbose ineshbose changed the title fix(dev-only-fallback): split regex to allow < character fix(dev-only-fallback): get fallback from parser May 14, 2023
@ineshbose
Copy link
Member Author

An app.vue that should cover the bases to test:

<script setup lang="ts">
</script>

<template>
  <!-- Edit this file to play around with Nuxt but never commit changes! -->
  <div>
    Nuxt 3 Playground
    <DevOnly>standard</DevOnly>
    <DevOnly>
      standard
      <template #fallback>
        <span>Fallback content</span>
      </template>
    </DevOnly>

    <DevOnly>
      <div>Element</div>
    </DevOnly>
    <DevOnly>
      <div>Element</div>
      <!-- comment -->
      <template #fallback>Fallback content2</template>
    </DevOnly>
    <DevOnly>
      Empty fallback
      <!-- empty fallback -->
      <template #fallback></template>
    </DevOnly>

    <DevOnly>
      <div>dev only</div>
      <ClientOnly>
        client only
        <div>client div</div>
        <template #fallback>
          <div>client fallback</div>
        </template>
      </ClientOnly>
      <template #fallback>
        <div>dev fallback</div>
      </template>
    </DevOnly>
  </div>
</template>

<style scoped>
</style>

Copy link
Member

@huang-julien huang-julien left a comment

Choose a reason for hiding this comment

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

πŸ‘ working wonderfully on my side

@danielroe danielroe changed the title fix(dev-only-fallback): get fallback from parser fix(nuxt): get fallback content for <DevOnly> from parsed html May 15, 2023
@danielroe danielroe changed the title fix(nuxt): get fallback content for <DevOnly> from parsed html fix(nuxt): get fallback for <DevOnly> from parsed html May 15, 2023
@danielroe danielroe merged commit 1f30cf1 into nuxt:main May 15, 2023
19 checks passed
This was referenced May 15, 2023
@ineshbose ineshbose deleted the dev-only-fallback branch February 15, 2024 11:04
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

Successfully merging this pull request may close these issues.

None yet

3 participants