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(react): add DevMode #470

Merged
merged 36 commits into from
Dec 25, 2023
Merged

feat(react): add DevMode #470

merged 36 commits into from
Dec 25, 2023

Conversation

manudeli
Copy link
Member

@manudeli manudeli commented Dec 13, 2023

fix: #446

Overview

@okinawaa @minsoo-web I want to add new feature DevMode in @suspensive/react or in new package @suspensive/react-devtools

Before add new feature, I want discuss this without explaining it. because I want to make DevMode's user understand it easily without studying

'use client'

import type { ErrorBoundaryFallbackProps } from '@suspensive/react'
import { DevMode, ErrorBoundary, Suspense, devMode } from '@suspensive/react'
import { Area, Box, Button, Spinner } from '~/components/uis'

export default function Page() {
  return (
    <Area title="devMode">
      <Area title="<Suspense devMode={{ showFallback: true }} />">
        <Suspense fallback={<Spinner />} devMode={{ showFallback: true }}>
          <Box.Success>children</Box.Success>
        </Suspense>
      </Area>

      <Area title="<ErrorBoundary devMode={{ showFallback: true }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: true }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
      <Area title="<ErrorBoundary devMode={{ showFallback: { after: 2000 } }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: { after: 2000 } }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
    </Area>
  )
}

const ErrorBoundaryFallback = ({ error, reset }: ErrorBoundaryFallbackProps) => (
  <Box.Error>
    {error.message}
    <Button onClick={reset}></Button>
  </Box.Error>
)

PR Checklist

  • I did below actions if need
  1. I read the Contributing Guide
  2. I added documents and tests.

Copy link

changeset-bot bot commented Dec 13, 2023

🦋 Changeset detected

Latest commit: 4e05229

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@suspensive/react Minor
@suspensive/react-query Minor
@suspensive/visualization Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2023 4:09pm
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 25, 2023 4:09pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
visualization ⬜️ Ignored (Inspect) Visit Preview Dec 25, 2023 4:09pm

@manudeli manudeli self-assigned this Dec 13, 2023
@manudeli manudeli added this to the v2 milestone Dec 13, 2023
Copy link

codesandbox-ci bot commented Dec 13, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

codecov bot commented Dec 13, 2023

Codecov Report

Merging #470 (4e05229) into main (b28ae8e) will decrease coverage by 7.27%.
The diff coverage is 50.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #470      +/-   ##
==========================================
- Coverage   81.37%   74.11%   -7.27%     
==========================================
  Files          25       29       +4     
  Lines         392      452      +60     
  Branches       84      110      +26     
==========================================
+ Hits          319      335      +16     
- Misses         63       98      +35     
- Partials       10       19       +9     
Components Coverage Δ
@suspensive/react 84.11% <50.00%> (-15.89%) ⬇️
@suspensive/react-query 0.00% <ø> (ø)
@suspensive/react-await 100.00% <ø> (ø)
@suspensive/react-image 24.00% <ø> (ø)

@vercel vercel bot temporarily deployed to Preview – docs-v1 December 13, 2023 18:46 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 13, 2023 18:46 Inactive
@vercel vercel bot temporarily deployed to Preview – visualization December 13, 2023 19:37 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 13, 2023 19:37 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 13, 2023 19:37 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 14, 2023 12:45 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 14, 2023 12:45 Inactive
@vercel vercel bot temporarily deployed to Preview – visualization December 14, 2023 12:46 Inactive
@minsoo-web
Copy link
Member

minsoo-web commented Dec 15, 2023

First of all, I'm sorry for the late confirmation.

In my case, I understood by looking at the code, but from the user's point of view, there seems to be something that needs to be improved by showing documents and example cases.

From my understanding, DevMode's role seems to be a tool to help you control

"when you want to see the fallback of Suspense, Errorboundry on purpose,"

is that right?

I think DevMode's naming made it harder to understand for now.

And assuming that we usually use developer tools, I think we only declared it once at the top and tested the development environment using only that tool. Redux or react-query are examples of that.

But now that user only can control each by calling DevMode components to a specific Suspense and Errorboundry, I thought it might be a little inconvenient for users.
Because, I think I'll have to intentionally erase the code when I go to production.

First of all, I think that if I understand what I meant, it would give me a great DX.
But I thought that we should give to user a guide through clear examples and documents to improve.

@minsoo-web
Copy link
Member

And visualization app is also production, user can't see Devmode 😢

@manudeli
Copy link
Member Author

Note to remember idea: how about make each Suspense, ErrorBoundary contain DevMode

@vercel vercel bot temporarily deployed to Preview – docs-v1 December 15, 2023 08:41 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 15, 2023 08:42 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 25, 2023 15:04 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 25, 2023 15:05 Inactive
@vercel vercel bot temporarily deployed to Preview – visualization December 25, 2023 15:06 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 25, 2023 15:08 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 25, 2023 15:09 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 25, 2023 15:16 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 25, 2023 15:18 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 25, 2023 15:54 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 25, 2023 15:55 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 December 25, 2023 16:08 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v1 December 25, 2023 16:09 Inactive
@manudeli manudeli merged commit 45ce93f into main Dec 25, 2023
18 checks passed
@manudeli manudeli deleted the react/feat/DevMode branch December 25, 2023 16:10
@manudeli manudeli restored the react/feat/DevMode branch December 25, 2023 16:13
manudeli added a commit that referenced this pull request Aug 3, 2024
fix: #446

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

@okinawaa @minsoo-web I want to add new feature `DevMode` in
@suspensive/react or in new package @suspensive/react-devtools

Before add new feature, I want discuss this without explaining it.
because I want to make DevMode's user understand it easily without
studying

```tsx
'use client'

import type { ErrorBoundaryFallbackProps } from '@suspensive/react'
import { DevMode, ErrorBoundary, Suspense, devMode } from '@suspensive/react'
import { Area, Box, Button, Spinner } from '~/components/uis'

export default function Page() {
  return (
    <Area title="devMode">
      <Area title="<Suspense devMode={{ showFallback: true }} />">
        <Suspense fallback={<Spinner />} devMode={{ showFallback: true }}>
          <Box.Success>children</Box.Success>
        </Suspense>
      </Area>

      <Area title="<ErrorBoundary devMode={{ showFallback: true }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: true }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
      <Area title="<ErrorBoundary devMode={{ showFallback: { after: 2000 } }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: { after: 2000 } }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
    </Area>
  )
}

const ErrorBoundaryFallback = ({ error, reset }: ErrorBoundaryFallbackProps) => (
  <Box.Error>
    {error.message}
    <Button onClick={reset}>↻</Button>
  </Box.Error>
)

```

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.

---------

Co-authored-by: Minsoo Kim <[email protected]>
manudeli added a commit that referenced this pull request Aug 3, 2024
fix: #446

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

@okinawaa @minsoo-web I want to add new feature `DevMode` in
@suspensive/react or in new package @suspensive/react-devtools

Before add new feature, I want discuss this without explaining it.
because I want to make DevMode's user understand it easily without
studying

```tsx
'use client'

import type { ErrorBoundaryFallbackProps } from '@suspensive/react'
import { DevMode, ErrorBoundary, Suspense, devMode } from '@suspensive/react'
import { Area, Box, Button, Spinner } from '~/components/uis'

export default function Page() {
  return (
    <Area title="devMode">
      <Area title="<Suspense devMode={{ showFallback: true }} />">
        <Suspense fallback={<Spinner />} devMode={{ showFallback: true }}>
          <Box.Success>children</Box.Success>
        </Suspense>
      </Area>

      <Area title="<ErrorBoundary devMode={{ showFallback: true }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: true }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
      <Area title="<ErrorBoundary devMode={{ showFallback: { after: 2000 } }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: { after: 2000 } }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
    </Area>
  )
}

const ErrorBoundaryFallback = ({ error, reset }: ErrorBoundaryFallbackProps) => (
  <Box.Error>
    {error.message}
    <Button onClick={reset}>↻</Button>
  </Box.Error>
)

```

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.

---------
manudeli added a commit that referenced this pull request Aug 3, 2024
fix: #446

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

@okinawaa @minsoo-web I want to add new feature `DevMode` in
@suspensive/react or in new package @suspensive/react-devtools

Before add new feature, I want discuss this without explaining it.
because I want to make DevMode's user understand it easily without
studying

```tsx
'use client'

import type { ErrorBoundaryFallbackProps } from '@suspensive/react'
import { DevMode, ErrorBoundary, Suspense, devMode } from '@suspensive/react'
import { Area, Box, Button, Spinner } from '~/components/uis'

export default function Page() {
  return (
    <Area title="devMode">
      <Area title="<Suspense devMode={{ showFallback: true }} />">
        <Suspense fallback={<Spinner />} devMode={{ showFallback: true }}>
          <Box.Success>children</Box.Success>
        </Suspense>
      </Area>

      <Area title="<ErrorBoundary devMode={{ showFallback: true }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: true }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
      <Area title="<ErrorBoundary devMode={{ showFallback: { after: 2000 } }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: { after: 2000 } }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
    </Area>
  )
}

const ErrorBoundaryFallback = ({ error, reset }: ErrorBoundaryFallbackProps) => (
  <Box.Error>
    {error.message}
    <Button onClick={reset}>↻</Button>
  </Box.Error>
)

```

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.

---------

Co-authored-by: Minsoo Kim <[email protected]>
manudeli added a commit that referenced this pull request Aug 3, 2024
fix: #446

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

@okinawaa @minsoo-web I want to add new feature `DevMode` in
@suspensive/react or in new package @suspensive/react-devtools

Before add new feature, I want discuss this without explaining it.
because I want to make DevMode's user understand it easily without
studying

```tsx
'use client'

import type { ErrorBoundaryFallbackProps } from '@suspensive/react'
import { DevMode, ErrorBoundary, Suspense, devMode } from '@suspensive/react'
import { Area, Box, Button, Spinner } from '~/components/uis'

export default function Page() {
  return (
    <Area title="devMode">
      <Area title="<Suspense devMode={{ showFallback: true }} />">
        <Suspense fallback={<Spinner />} devMode={{ showFallback: true }}>
          <Box.Success>children</Box.Success>
        </Suspense>
      </Area>

      <Area title="<ErrorBoundary devMode={{ showFallback: true }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: true }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
      <Area title="<ErrorBoundary devMode={{ showFallback: { after: 2000 } }} />">
        <ErrorBoundary fallback={ErrorBoundaryFallback} devMode={{ showFallback: { after: 2000 } }}>
          <Box.Default>children</Box.Default>
        </ErrorBoundary>
      </Area>
    </Area>
  )
}

const ErrorBoundaryFallback = ({ error, reset }: ErrorBoundaryFallbackProps) => (
  <Box.Error>
    {error.message}
    <Button onClick={reset}>↻</Button>
  </Box.Error>
)

```

## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.

---------

Co-authored-by: Minsoo Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: add DevMode
2 participants